diff --git a/banco/.gitignore b/banco/.gitignore new file mode 100644 index 00000000..2b75303a --- /dev/null +++ b/banco/.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/banco/.idea/encodings.xml b/banco/.idea/encodings.xml new file mode 100644 index 00000000..15a15b21 --- /dev/null +++ b/banco/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/banco/.idea/gradle.xml b/banco/.idea/gradle.xml new file mode 100644 index 00000000..2996d531 --- /dev/null +++ b/banco/.idea/gradle.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/banco/.idea/misc.xml b/banco/.idea/misc.xml new file mode 100644 index 00000000..9fdea7e6 --- /dev/null +++ b/banco/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/banco/.idea/runConfigurations.xml b/banco/.idea/runConfigurations.xml new file mode 100644 index 00000000..7f68460d --- /dev/null +++ b/banco/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/banco/.idea/vcs.xml b/banco/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/banco/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/banco/app/.gitignore b/banco/app/.gitignore new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ b/banco/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/banco/app/build.gradle b/banco/app/build.gradle new file mode 100644 index 00000000..6b356ba4 --- /dev/null +++ b/banco/app/build.gradle @@ -0,0 +1,57 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 28 + // buildToolsVersion rootProject.buildToolsVersion + defaultConfig { + applicationId "com.bank.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' + } + } + // 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.android.support.constraint:constraint-layout:1.0.3' + + implementation 'com.google.code.gson:gson:2.7' + + 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 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/banco/app/libs/activation.jar b/banco/app/libs/activation.jar new file mode 100644 index 00000000..614a03cd Binary files /dev/null and b/banco/app/libs/activation.jar differ diff --git a/banco/app/libs/additionnal.jar b/banco/app/libs/additionnal.jar new file mode 100644 index 00000000..aeb9611f Binary files /dev/null and b/banco/app/libs/additionnal.jar differ diff --git a/banco/app/libs/mail.jar b/banco/app/libs/mail.jar new file mode 100644 index 00000000..ea594fdd Binary files /dev/null and b/banco/app/libs/mail.jar differ diff --git a/banco/app/proguard-rules.pro b/banco/app/proguard-rules.pro new file mode 100644 index 00000000..f1b42451 --- /dev/null +++ b/banco/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/banco/app/src/androidTest/java/br/banco/services/ExampleInstrumentedTest.java b/banco/app/src/androidTest/java/br/banco/services/ExampleInstrumentedTest.java new file mode 100644 index 00000000..43a1049a --- /dev/null +++ b/banco/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/banco/app/src/androidTest/java/br/banco/services/app/alert/AlertTest.java b/banco/app/src/androidTest/java/br/banco/services/app/alert/AlertTest.java new file mode 100644 index 00000000..c6ead220 --- /dev/null +++ b/banco/app/src/androidTest/java/br/banco/services/app/alert/AlertTest.java @@ -0,0 +1,22 @@ +package br.banco.services.app.alert; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class AlertTest { + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void getArea() { + } +} \ No newline at end of file diff --git a/banco/app/src/androidTest/java/br/banco/services/app/alert/AlertViewTest.java b/banco/app/src/androidTest/java/br/banco/services/app/alert/AlertViewTest.java new file mode 100644 index 00000000..f017f252 --- /dev/null +++ b/banco/app/src/androidTest/java/br/banco/services/app/alert/AlertViewTest.java @@ -0,0 +1,50 @@ +package br.banco.services.app.alert; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class AlertViewTest { + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void onCreate() { + } + + @Test + public void onResume() { + } + + @Test + public void updateAlertView() { + } + + @Test + public void checkInternet() { + } + + @Test + public void drawView() { + } + + @Test + public void showProgressBar() { + } + + @Test + public void hideProgressBar() { + } + + @Test + public void onKeyDown() { + } +} \ No newline at end of file diff --git a/banco/app/src/androidTest/java/br/banco/services/app/utils/ValidatorEmailTest.java b/banco/app/src/androidTest/java/br/banco/services/app/utils/ValidatorEmailTest.java new file mode 100644 index 00000000..7a40579f --- /dev/null +++ b/banco/app/src/androidTest/java/br/banco/services/app/utils/ValidatorEmailTest.java @@ -0,0 +1,64 @@ +/* + * Copyright 2015, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package br.banco.services.app.utils; + +import org.junit.Test; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + + +public class ValidatorEmailTest { + + // true + + @Test + public void ValidatorEmail_Com_Dominio_True() { + assertTrue(ValidatorEmail.isValidEmail("name@email.com")); + } + + @Test + public void ValidatorEmail_Com_Dominio_Subdominio_True() { + assertTrue(ValidatorEmail.isValidEmail("name@email.co.uk")); + } + + // false + + @Test + public void ValidatorEmail_Sem_dominio_False() { + assertFalse(ValidatorEmail.isValidEmail("name@email")); + } + + @Test + public void ValidatorEmail_Com_Dois_Pontos_False() { + assertFalse(ValidatorEmail.isValidEmail("name@email..com")); + } + + @Test + public void ValidatorEmail_Sem_Nome_De_Usuario_False() { + assertFalse(ValidatorEmail.isValidEmail("@email.com")); + } + + @Test + public void ValidatorEmail_Com_Email_Vazio_False() { + assertFalse(ValidatorEmail.isValidEmail("")); + } + + @Test + public void ValidatorEmail_Com_Email_Nulo_false() { + assertFalse(ValidatorEmail.isValidEmail(null)); + } +} diff --git a/banco/app/src/androidTest/java/br/banco/services/app/utils/ValidatorNameTest.java b/banco/app/src/androidTest/java/br/banco/services/app/utils/ValidatorNameTest.java new file mode 100644 index 00000000..8df05d28 --- /dev/null +++ b/banco/app/src/androidTest/java/br/banco/services/app/utils/ValidatorNameTest.java @@ -0,0 +1,94 @@ +/* + * Copyright 2015, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package br.banco.services.app.utils; + +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + + + +public class ValidatorNameTest { + + // false ------------------------------- + + //haveWords + + @Test + public void ValidatorName_Com_Caracteres_Especiais_Retorna_False() { + assertFalse(ValidatorName.haveWords("##")); + } + @Test + public void ValidatorName_Com_Numeros_Retorna_False() { + assertFalse(ValidatorName.haveWords("123456")); + } + @Test + public void ValidatorName_Com_Espaco_Branco_Retorna_False() { + assertFalse(ValidatorName.haveWords(" ")); + } + @Test + public void ValidatorName_Com_Nulo_Retorna_False() { + assertFalse(ValidatorName.haveWords(null)); + } + //haveSize + @Test + public void ValidatorName_Menor_Que_02_Letras_Retorna_False() { + assertFalse(ValidatorName.haveSize("J")); + } + @Test + public void ValidatorName_Maior_Que_25_Letras_Retorna_False() { + assertFalse(ValidatorName.haveSize("Inconstitucionalissimamente")); // 27 letras + } + //haveParts + @Test + public void ValidatorName_Menor_Que_02_Palavras_Retorna_False() { + assertFalse(ValidatorName.haveParts("Jhon")); // 1 + } + @Test + public void ValidatorName_Maior_Que_4_Palavras_Retorna_False() { + assertFalse(ValidatorName.haveParts("Jhon Doe Smith Jhonson Junior")); // 5 + } + // retorno final + @Test + public void ValidatorName_Nome_Com_01_Palavra_Retorna_False() { + assertFalse(ValidatorName.isValidName("Jhon")); // 1 + } + @Test + public void ValidatorName_Nome_Com_05_Palavra_Retorna_False() { + assertFalse(ValidatorName.isValidName("Jhon Doe Smith Jhonson Junior")); // 5 + } + + @Test + public void ValidatorName_Nome_Com_Caracteres_Especiais_Retorna_False() { + assertFalse(ValidatorName.isValidName("Jhon Doe ##")); + } + @Test + public void ValidatorName_Nome_Com_Numeros_Retorna_False() { + assertFalse(ValidatorName.isValidName("Jhon Doe 12345")); + } + @Test + + public void ValidatorName_Nome_Com_Ponto_Retorna_False() { + assertFalse(ValidatorName.isValidName("Jhon D. Smith")); + } + // True ------------------------------- + + + + +} \ No newline at end of file diff --git a/banco/app/src/androidTest/java/br/banco/services/app/utils/ValidatorPhoneTest.java b/banco/app/src/androidTest/java/br/banco/services/app/utils/ValidatorPhoneTest.java new file mode 100644 index 00000000..591ad366 --- /dev/null +++ b/banco/app/src/androidTest/java/br/banco/services/app/utils/ValidatorPhoneTest.java @@ -0,0 +1,76 @@ +/* + * Copyright 2015, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package br.banco.services.app.utils; + +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + + +public class ValidatorPhoneTest { + + // false ------------------------------- + + + @Test + public void ValidatorPhone_Com_Caracteres_Especiais_Retorna_False() { + assertFalse(ValidatorPhone.isPhoneNumeric("##")); + } + + @Test + public void ValidatorPhone_Com_Espaco_Branco_Retorna_False() { + assertFalse(ValidatorPhone.isPhoneNumeric(" ")); + } + + @Test + public void ValidatorPhone_Com_Nulo_Retorna_False() { + assertFalse(ValidatorPhone.isPhoneNumeric(null)); + } + + + @Test + public void ValidatorPhone_Menor_Que_10_Numeros_Retorna_False() { + assertFalse(ValidatorPhone.isPhoneNumeric("991234567")); // 7 + } + + + @Test + public void ValidatorPhone_Maior_Que_13_Numeros_Retorna_False() { + assertFalse(ValidatorPhone.isPhoneNumeric("55995555777799")); //14 + } + + + //true + + @Test + public void ValidatorPhone_Igual_10_Numeros_Retorna_True() { + assertTrue(ValidatorPhone.isPhoneNumeric("1155555555")); // 10 + } + + @Test + public void ValidatorPhone_Igual_13_Numeros_Retorna_True() { + assertTrue(ValidatorPhone.isPhoneNumeric("5599555577779")); // 13 + } + + // True ------------------------------- + + + + + +} \ No newline at end of file diff --git a/banco/app/src/androidTest/java/br/banco/services/app/utils/ValidatorURLTest.java b/banco/app/src/androidTest/java/br/banco/services/app/utils/ValidatorURLTest.java new file mode 100644 index 00000000..f475da80 --- /dev/null +++ b/banco/app/src/androidTest/java/br/banco/services/app/utils/ValidatorURLTest.java @@ -0,0 +1,26 @@ +package br.banco.services.app.utils; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class ValidatorURLTest { + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void isValid() { + } + + @Test + public void isValidURL() { + } +} \ No newline at end of file diff --git a/banco/app/src/androidTest/java/br/banco/services/fund/data/template/FromScreenTest.java b/banco/app/src/androidTest/java/br/banco/services/fund/data/template/FromScreenTest.java new file mode 100644 index 00000000..52dccad3 --- /dev/null +++ b/banco/app/src/androidTest/java/br/banco/services/fund/data/template/FromScreenTest.java @@ -0,0 +1,12 @@ +package br.banco.services.fund.data.template; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class FromScreenTest { + + @Test + public void getName() { + } +} \ No newline at end of file diff --git a/banco/app/src/androidTest/java/br/banco/services/fund/detail/DetailModelTest.java b/banco/app/src/androidTest/java/br/banco/services/fund/detail/DetailModelTest.java new file mode 100644 index 00000000..4320d3ce --- /dev/null +++ b/banco/app/src/androidTest/java/br/banco/services/fund/detail/DetailModelTest.java @@ -0,0 +1,64 @@ +package br.banco.services.fund.detail; + +import org.junit.Before; +import org.junit.Test; + +import br.banco.services.app.utils.ValidatorName; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class DetailModelTest { + + DetailModel model; + @Before + public void setUp() throws Exception{ + model = new DetailModel(); + } + + @Test public void getOrigin() { + + // model.setOrigin(99); + assertNotNull(model.getOrigin()); + + model.setOrigin(0); + assertEquals(0, model.getOrigin()); + + model.setOrigin(1); + assertEquals(1, model.getOrigin()); + + model.setOrigin(555); + assertEquals(0, model.getOrigin()); + + } + + @Test public void getLocation() { + + assertNotNull(model.getLocation()); + + model.setLocation(0+555); + assertEquals(0, model.getLocation()); + + model.setLocation(0); + assertEquals(0, model.getLocation()); + + model.setLocation(-555); + assertEquals(0, model.getLocation()); + + model.setLocation(1); + assertEquals(1, model.getLocation()); + + model.setLocation(555); + assertEquals(0, model.getLocation()); + + } + + @Test(expected=java.lang.ArithmeticException.class) + public void getOrigin_DivideByZero() { + model.setLocation(555 / 0); + assertEquals(0, model.getOrigin()); + } + + +} \ No newline at end of file diff --git a/banco/app/src/androidTest/java/br/banco/services/fund/detail/DetailViewTest.java b/banco/app/src/androidTest/java/br/banco/services/fund/detail/DetailViewTest.java new file mode 100644 index 00000000..59263f2e --- /dev/null +++ b/banco/app/src/androidTest/java/br/banco/services/fund/detail/DetailViewTest.java @@ -0,0 +1,35 @@ +package br.banco.services.fund.detail; + +import android.util.Log; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class DetailViewTest { + + DetailView detailView; + + @Before + public void setUp() throws Exception { + detailView = new DetailView(); + } + + + + @Test + public void checkInternet() { + + String INTERNET = (detailView.checkInternet()) ? "SIM" : "NAO"; + + // Log.e("TESTSUNIT","INTERNET = " + INTERNET); + //assertTrue(detailView.checkInternet()); + // assertFalse(detailView.checkInternet()); + } + + + + + +} \ No newline at end of file diff --git a/banco/app/src/androidTest/java/br/banco/services/fund/domain/FundTest.java b/banco/app/src/androidTest/java/br/banco/services/fund/domain/FundTest.java new file mode 100644 index 00000000..671d12e2 --- /dev/null +++ b/banco/app/src/androidTest/java/br/banco/services/fund/domain/FundTest.java @@ -0,0 +1,42 @@ +/* + * Copyright 2015, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package br.banco.services.fund.domain; + +import org.junit.Test; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import br.banco.services.app.utils.ValidatorName; + + + +public class FundTest { + + //haveWords ------------------------------- + + //@Test(expected = IllegalArgumentException.class) + @Test + public void Com_Caracteres_Especiais_Retorna_False() { + assertFalse(ValidatorName.haveWords("##")); + } + + @Test + public void Com_Letras_Retorna_True() { + assertTrue(ValidatorName.haveWords("Zeus FUND Name Debentures")); + } + +} \ No newline at end of file diff --git a/banco/app/src/androidTest/java/br/banco/services/fund/interactor/ConvertJsonTest.java b/banco/app/src/androidTest/java/br/banco/services/fund/interactor/ConvertJsonTest.java new file mode 100644 index 00000000..eaf31dba --- /dev/null +++ b/banco/app/src/androidTest/java/br/banco/services/fund/interactor/ConvertJsonTest.java @@ -0,0 +1,14 @@ +package br.banco.services.fund.interactor; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class ConvertJsonTest { + + @Test + public void convertStringJson() { + + + } +} \ No newline at end of file diff --git a/banco/app/src/main/AndroidManifest.xml b/banco/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..dc24e7f4 --- /dev/null +++ b/banco/app/src/main/AndroidManifest.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/java/br/banco/services/BasePresenter.java b/banco/app/src/main/java/br/banco/services/BasePresenter.java new file mode 100644 index 00000000..4ab7d89b --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/BasePresenter.java @@ -0,0 +1,6 @@ +package br.banco.services; + +public interface BasePresenter { + + void start(); +} diff --git a/banco/app/src/main/java/br/banco/services/BaseView.java b/banco/app/src/main/java/br/banco/services/BaseView.java new file mode 100644 index 00000000..5dfb6d55 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/BaseView.java @@ -0,0 +1,6 @@ + package br.banco.services; + +public interface BaseView { + + void start(); +} diff --git a/banco/app/src/main/java/br/banco/services/CheckDevice.java b/banco/app/src/main/java/br/banco/services/CheckDevice.java new file mode 100644 index 00000000..09753bf0 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/CheckDevice.java @@ -0,0 +1,62 @@ + package br.banco.services; + +/** + * + * Sequencia de carregamento: + * + * FUND, CONTACT: + * View> Presenter-> Model> Screen> Rules> dbase[Json / Share / dbase] + * Rules[...] = 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/banco/app/src/main/java/br/banco/services/app/alert/AlertView.java b/banco/app/src/main/java/br/banco/services/app/alert/AlertView.java new file mode 100644 index 00000000..4b0f17b2 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/alert/AlertView.java @@ -0,0 +1,200 @@ + /* + + 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/banco/app/src/main/java/br/banco/services/app/config/ConfigServers.java b/banco/app/src/main/java/br/banco/services/app/config/ConfigServers.java new file mode 100644 index 00000000..0a721e7b --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/config/ConfigServers.java @@ -0,0 +1,47 @@ +/* + Endereços ficaram acessiveis para facilitar a mudança de servidores +*/ + +package br.banco.services.app.config; + +public final class ConfigServers { + + public String contactAdress ="https://floating-mountain-50292.herokuapp.com/cells.json"; + public String fundAdress ="https://floating-mountain-50292.herokuapp.com/fund.json"; + public String AlertAdress =""; + public String MessageAdress =""; + + public String getContactAdress() { + return contactAdress; + } + + public void setContactAdress(String contactAdress) { + this.contactAdress = contactAdress; + } + + public String getFundAdress() { + return fundAdress; + } + + public void setFundAdress(String fundAdress) { + this.fundAdress = fundAdress; + } + + + public String getAlertAdress() { + return AlertAdress; + } + + public void setAlertAdress(String alertAdress) { + AlertAdress = alertAdress; + } + + public String getMessageAdress() { + return MessageAdress; + } + + public void setMessageAdress(String messageAdress) { + MessageAdress = messageAdress; + } +} + diff --git a/banco/app/src/main/java/br/banco/services/app/design/DrawProgressBar.java b/banco/app/src/main/java/br/banco/services/app/design/DrawProgressBar.java new file mode 100644 index 00000000..4203c986 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/design/DrawProgressBar.java @@ -0,0 +1,95 @@ +package br.banco.services.app.design; + +import android.app.Activity; +import android.content.Context; +import android.graphics.Color; +import android.graphics.PorterDuff; +import android.util.DisplayMetrics; +import android.view.Display; +import android.view.View; +import android.widget.ProgressBar; +import android.widget.RelativeLayout; +import android.view.Window; +import android.view.WindowManager; + +public class DrawProgressBar { + + + + + public void initProgressBar2(Context context) { + + ProgressBar progressBar; + int marginTop = 0; + int marginLeft = 0; + + // size + DisplayMetrics displayMetrics = new DisplayMetrics(); + // Display display = getWindowManager().getDefaultDisplay(); + + ((Activity)context).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); + + + //WindowManager window = new WindowManager(); + // ((Activity) getContext()).getWindowManager().getDefaultDisplay().getMetrics(metrics); + + // window.getDefaultDisplay().getW + //window.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); + + + } + + + public void initProgressBar(Context context) { + + int marginTop = 0; + int marginLeft = 0; + ProgressBar progressBar; + + // size + DisplayMetrics displayMetrics = new DisplayMetrics(); + // getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); + //this.getActivity().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(context, 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(context); + + // params + RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(160, 160); + params.setMargins(marginLeft, marginTop, 0, 0); + + // this.addContentView(progressBar, params); + // hideProgressBar(); + } + + + + public void showProgressBar(Context context, ProgressBar progressBar) { + progressBar.setVisibility(View.VISIBLE); + } + + public void hideProgressBar(Context context,ProgressBar progressBar) { + progressBar.setVisibility(View.INVISIBLE); + } + + + + +} + + diff --git a/banco/app/src/main/java/br/banco/services/app/design/DrawTextView.java b/banco/app/src/main/java/br/banco/services/app/design/DrawTextView.java new file mode 100644 index 00000000..3de3643c --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/design/DrawTextView.java @@ -0,0 +1,12 @@ +package br.banco.services.app.design; + +public class DrawTextView { + + + String id; + String layout_width; + String layout_height; + String text; + String layout_centerInParent; + +} diff --git a/banco/app/src/main/java/br/banco/services/app/design/DrawView.java b/banco/app/src/main/java/br/banco/services/app/design/DrawView.java new file mode 100644 index 00000000..51ca7ff0 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/design/DrawView.java @@ -0,0 +1,38 @@ +package br.banco.services.app.design; + +import android.app.Activity; +import android.content.Context; +import android.graphics.Color; + +import android.view.View; +import android.widget.RelativeLayout; + +public class DrawView { + + + + + + public View initView(Context context, View view) { + + return view; + } + + + + public View showinitView(Context context, View view) { + view.setVisibility(View.VISIBLE); + return view; + } + + public View hideinitView(Context context,View view) { + view.setVisibility(View.INVISIBLE); + return view; + } + + + + +} + + diff --git a/banco/app/src/main/java/br/banco/services/app/design/TDrawTextView.java b/banco/app/src/main/java/br/banco/services/app/design/TDrawTextView.java new file mode 100644 index 00000000..c2566c3f --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/design/TDrawTextView.java @@ -0,0 +1,828 @@ +package br.banco.services.app.design; + +public class TDrawTextView { + + + String AallowUndo_p; + String autoLink_p; + String autoSizeMaxTextSize_p; + String autoSizeMinTextSize_p; + String autoSizePresetSizes_p; + String autoSizeStepGranularity_p; + String autoSizeTextType_p; + String autoText_p; + String breakStrategy_p; + String bufferType_p; + String capitalize_p; + String cursorVisibl_p; + String digits_p; + String drawableBottom_p; + String drawableEnd_p; + String drawableLeft_p; + String drawablePadding_p; + String drawableRight_p; + String drawableStart_p; + String drawableTint_p; + String drawableTintMode_p; + String drawableTop_p; + String editable_p; + String editorExtras_p; + String elegantTextHeight_p; + String ellipsiz_p; + String ems_p; + String enabled_p; + String fallbackLineSpacing_p; + String firstBaselineToTopHeight_p; + String fontFamily_p; + String fontFeatureSettings_p; + String fontVariationSettings_p; + String freezesText_p; + String gravity_p; + String height_p; + String hint_p; + String hyphenationFrequency_p; + String imeActionId_p; + String imeActionLabel_p; + String imeOption_p; + String includeFontPadding_p; + String inputMethod_p; + String inputType_p; + String justificationMode_p; + String lastBaselineToBottomHeight_p; + String letterSpacing_p; + String lineHeight_p; + String lineSpacingExtra_p; + String lineSpacingMultiplier_p; + String lines_p; + String linksClickable_p; + String marqueeRepeatLimit_p; + String maxEms_p; + String maxHeight_p; + String maxLength_p; + String maxLines_p; + String maxWidth_p; + String minEms_p; + String minHeight_p; + String minLines_p; + String minWidth_p; + String numeric_p; + String password_p; + String phoneNumber_p; + String privateImeOptions_p; + String scrollHorizontally_p; + String selectAllOnFocus_p; + String shadowColor_p; + String shadowDx_p; + String shadowDy_p; + String shadowRadius_p; + String singleLine_p; + String text_p; + String textAllCaps_p; + String textAppearance_p; + String textColor_p; + String textColorHighlight_p; + String textColorHint_p; + String textColorLink_p; + String textCursorDrawable_p; + String textFontWeight_p; + String textIsSelectable_p; + String textScaleX_p; + String textSelectHandle_p; + String textSelectHandleLeft_p; + String textSelectHandleRight_p; + int textSize_p; + String textStyle_p; + String typeface_p; + String width_p; + + + public String getAallowUndo_p() { + return AallowUndo_p; + } + + public void setAallowUndo_p(String aallowUndo_p) { + AallowUndo_p = aallowUndo_p; + } + + public String getAutoLink_p() { + return autoLink_p; + } + + public void setAutoLink_p(String autoLink_p) { + this.autoLink_p = autoLink_p; + } + + + public String getAutoSizeMaxTextSize_p() { + return autoSizeMaxTextSize_p; + } + + public void setAutoSizeMaxTextSize_p(String autoSizeMaxTextSize_p) { + this.autoSizeMaxTextSize_p = autoSizeMaxTextSize_p; + } + + public String getAutoSizeMinTextSize_p() { + return autoSizeMinTextSize_p; + } + + public void setAutoSizeMinTextSize_p(String autoSizeMinTextSize_p) { + this.autoSizeMinTextSize_p = autoSizeMinTextSize_p; + } + + + public String getAutoSizePresetSizes_p() { + return autoSizePresetSizes_p; + } + + public void setAutoSizePresetSizes_p(String autoSizePresetSizes_p) { + this.autoSizePresetSizes_p = autoSizePresetSizes_p; + } + + public String getAutoSizeStepGranularity_p() { + return autoSizeStepGranularity_p; + } + + public void setAutoSizeStepGranularity_p(String autoSizeStepGranularity_p) { + this.autoSizeStepGranularity_p = autoSizeStepGranularity_p; + } + + public String getAutoSizeTextType_p() { + return autoSizeTextType_p; + } + + public void setAutoSizeTextType_p(String autoSizeTextType_p) { + this.autoSizeTextType_p = autoSizeTextType_p; + } + + public String getAutoText_p() { + return autoText_p; + } + + public void setAutoText_p(String autoText_p) { + this.autoText_p = autoText_p; + } + + public String getBreakStrategy_p() { + return breakStrategy_p; + } + + public void setBreakStrategy_p(String breakStrategy_p) { + this.breakStrategy_p = breakStrategy_p; + } + + public String getBufferType_p() { + return bufferType_p; + } + + public void setBufferType_p(String bufferType_p) { + this.bufferType_p = bufferType_p; + } + + public String getCapitalize_p() { + return capitalize_p; + } + + public void setCapitalize_p(String capitalize_p) { + this.capitalize_p = capitalize_p; + } + + public String getCursorVisibl_p() { + return cursorVisibl_p; + } + + public void setCursorVisibl_p(String cursorVisibl_p) { + this.cursorVisibl_p = cursorVisibl_p; + } + + public String getDigits_p() { + return digits_p; + } + + public void setDigits_p(String digits_p) { + this.digits_p = digits_p; + } + + public String getDrawableBottom_p() { + return drawableBottom_p; + } + + public void setDrawableBottom_p(String drawableBottom_p) { + this.drawableBottom_p = drawableBottom_p; + } + + public String getDrawableEnd_p() { + return drawableEnd_p; + } + + public void setDrawableEnd_p(String drawableEnd_p) { + this.drawableEnd_p = drawableEnd_p; + } + + public String getDrawableLeft_p() { + return drawableLeft_p; + } + + public void setDrawableLeft_p(String drawableLeft_p) { + this.drawableLeft_p = drawableLeft_p; + } + + public String getDrawablePadding_p() { + return drawablePadding_p; + } + + public void setDrawablePadding_p(String drawablePadding_p) { + this.drawablePadding_p = drawablePadding_p; + } + + public String getDrawableRight_p() { + return drawableRight_p; + } + + public void setDrawableRight_p(String drawableRight_p) { + this.drawableRight_p = drawableRight_p; + } + + public String getDrawableStart_p() { + return drawableStart_p; + } + + public void setDrawableStart_p(String drawableStart_p) { + this.drawableStart_p = drawableStart_p; + } + + public String getDrawableTint_p() { + return drawableTint_p; + } + + public void setDrawableTint_p(String drawableTint_p) { + this.drawableTint_p = drawableTint_p; + } + + public String getDrawableTintMode_p() { + return drawableTintMode_p; + } + + public void setDrawableTintMode_p(String drawableTintMode_p) { + this.drawableTintMode_p = drawableTintMode_p; + } + + public String getDrawableTop_p() { + return drawableTop_p; + } + + public void setDrawableTop_p(String drawableTop_p) { + this.drawableTop_p = drawableTop_p; + } + + public String getEditable_p() { + return editable_p; + } + + public void setEditable_p(String editable_p) { + this.editable_p = editable_p; + } + + public String getEditorExtras_p() { + return editorExtras_p; + } + + public void setEditorExtras_p(String editorExtras_p) { + this.editorExtras_p = editorExtras_p; + } + + public String getElegantTextHeight_p() { + return elegantTextHeight_p; + } + + public void setElegantTextHeight_p(String elegantTextHeight_p) { + this.elegantTextHeight_p = elegantTextHeight_p; + } + + public String getEllipsiz_p() { + return ellipsiz_p; + } + + public void setEllipsiz_p(String ellipsiz_p) { + this.ellipsiz_p = ellipsiz_p; + } + + public String getEms_p() { + return ems_p; + } + + public void setEms_p(String ems_p) { + this.ems_p = ems_p; + } + + public String getEnabled_p() { + return enabled_p; + } + + public void setEnabled_p(String enabled_p) { + this.enabled_p = enabled_p; + } + + public String getFallbackLineSpacing_p() { + return fallbackLineSpacing_p; + } + + public void setFallbackLineSpacing_p(String fallbackLineSpacing_p) { + this.fallbackLineSpacing_p = fallbackLineSpacing_p; + } + + public String getFirstBaselineToTopHeight_p() { + return firstBaselineToTopHeight_p; + } + + public void setFirstBaselineToTopHeight_p(String firstBaselineToTopHeight_p) { + this.firstBaselineToTopHeight_p = firstBaselineToTopHeight_p; + } + + public String getFontFamily_p() { + return fontFamily_p; + } + + public void setFontFamily_p(String fontFamily_p) { + this.fontFamily_p = fontFamily_p; + } + + public String getFontFeatureSettings_p() { + return fontFeatureSettings_p; + } + + public void setFontFeatureSettings_p(String fontFeatureSettings_p) { + this.fontFeatureSettings_p = fontFeatureSettings_p; + } + + public String getFontVariationSettings_p() { + return fontVariationSettings_p; + } + + public void setFontVariationSettings_p(String fontVariationSettings_p) { + this.fontVariationSettings_p = fontVariationSettings_p; + } + + public String getFreezesText_p() { + return freezesText_p; + } + + public void setFreezesText_p(String freezesText_p) { + this.freezesText_p = freezesText_p; + } + + public String getGravity_p() { + return gravity_p; + } + + public void setGravity_p(String gravity_p) { + this.gravity_p = gravity_p; + } + + public String getHeight_p() { + return height_p; + } + + public void setHeight_p(String height_p) { + this.height_p = height_p; + } + + public String getHint_p() { + return hint_p; + } + + public void setHint_p(String hint_p) { + this.hint_p = hint_p; + } + + public String getHyphenationFrequency_p() { + return hyphenationFrequency_p; + } + + public void setHyphenationFrequency_p(String hyphenationFrequency_p) { + this.hyphenationFrequency_p = hyphenationFrequency_p; + } + + public String getImeActionId_p() { + return imeActionId_p; + } + + public void setImeActionId_p(String imeActionId_p) { + this.imeActionId_p = imeActionId_p; + } + + public String getImeActionLabel_p() { + return imeActionLabel_p; + } + + public void setImeActionLabel_p(String imeActionLabel_p) { + this.imeActionLabel_p = imeActionLabel_p; + } + + public String getImeOption_p() { + return imeOption_p; + } + + public void setImeOption_p(String imeOption_p) { + this.imeOption_p = imeOption_p; + } + + public String getIncludeFontPadding_p() { + return includeFontPadding_p; + } + + public void setIncludeFontPadding_p(String includeFontPadding_p) { + this.includeFontPadding_p = includeFontPadding_p; + } + + public String getInputMethod_p() { + return inputMethod_p; + } + + public void setInputMethod_p(String inputMethod_p) { + this.inputMethod_p = inputMethod_p; + } + + public String getInputType_p() { + return inputType_p; + } + + public void setInputType_p(String inputType_p) { + this.inputType_p = inputType_p; + } + + public String getJustificationMode_p() { + return justificationMode_p; + } + + public void setJustificationMode_p(String justificationMode_p) { + this.justificationMode_p = justificationMode_p; + } + + public String getLastBaselineToBottomHeight_p() { + return lastBaselineToBottomHeight_p; + } + + public void setLastBaselineToBottomHeight_p(String lastBaselineToBottomHeight_p) { + this.lastBaselineToBottomHeight_p = lastBaselineToBottomHeight_p; + } + + public String getLetterSpacing_p() { + return letterSpacing_p; + } + + public void setLetterSpacing_p(String letterSpacing_p) { + this.letterSpacing_p = letterSpacing_p; + } + + public String getLineHeight_p() { + return lineHeight_p; + } + + public void setLineHeight_p(String lineHeight_p) { + this.lineHeight_p = lineHeight_p; + } + + public String getLineSpacingExtra_p() { + return lineSpacingExtra_p; + } + + public void setLineSpacingExtra_p(String lineSpacingExtra_p) { + this.lineSpacingExtra_p = lineSpacingExtra_p; + } + + public String getLineSpacingMultiplier_p() { + return lineSpacingMultiplier_p; + } + + public void setLineSpacingMultiplier_p(String lineSpacingMultiplier_p) { + this.lineSpacingMultiplier_p = lineSpacingMultiplier_p; + } + + public String getLines_p() { + return lines_p; + } + + public void setLines_p(String lines_p) { + this.lines_p = lines_p; + } + + public String getLinksClickable_p() { + return linksClickable_p; + } + + public void setLinksClickable_p(String linksClickable_p) { + this.linksClickable_p = linksClickable_p; + } + + public String getMarqueeRepeatLimit_p() { + return marqueeRepeatLimit_p; + } + + public void setMarqueeRepeatLimit_p(String marqueeRepeatLimit_p) { + this.marqueeRepeatLimit_p = marqueeRepeatLimit_p; + } + + public String getMaxEms_p() { + return maxEms_p; + } + + public void setMaxEms_p(String maxEms_p) { + this.maxEms_p = maxEms_p; + } + + public String getMaxHeight_p() { + return maxHeight_p; + } + + public void setMaxHeight_p(String maxHeight_p) { + this.maxHeight_p = maxHeight_p; + } + + public String getMaxLength_p() { + return maxLength_p; + } + + public void setMaxLength_p(String maxLength_p) { + this.maxLength_p = maxLength_p; + } + + public String getMaxLines_p() { + return maxLines_p; + } + + public void setMaxLines_p(String maxLines_p) { + this.maxLines_p = maxLines_p; + } + + public String getMaxWidth_p() { + return maxWidth_p; + } + + public void setMaxWidth_p(String maxWidth_p) { + this.maxWidth_p = maxWidth_p; + } + + public String getMinEms_p() { + return minEms_p; + } + + public void setMinEms_p(String minEms_p) { + this.minEms_p = minEms_p; + } + + public String getMinHeight_p() { + return minHeight_p; + } + + public void setMinHeight_p(String minHeight_p) { + this.minHeight_p = minHeight_p; + } + + public String getMinLines_p() { + return minLines_p; + } + + public void setMinLines_p(String minLines_p) { + this.minLines_p = minLines_p; + } + + public String getMinWidth_p() { + return minWidth_p; + } + + public void setMinWidth_p(String minWidth_p) { + this.minWidth_p = minWidth_p; + } + + public String getNumeric_p() { + return numeric_p; + } + + public void setNumeric_p(String numeric_p) { + this.numeric_p = numeric_p; + } + + public String getPassword_p() { + return password_p; + } + + public void setPassword_p(String password_p) { + this.password_p = password_p; + } + + public String getPhoneNumber_p() { + return phoneNumber_p; + } + + public void setPhoneNumber_p(String phoneNumber_p) { + this.phoneNumber_p = phoneNumber_p; + } + + public String getPrivateImeOptions_p() { + return privateImeOptions_p; + } + + public void setPrivateImeOptions_p(String privateImeOptions_p) { + this.privateImeOptions_p = privateImeOptions_p; + } + + public String getScrollHorizontally_p() { + return scrollHorizontally_p; + } + + public void setScrollHorizontally_p(String scrollHorizontally_p) { + this.scrollHorizontally_p = scrollHorizontally_p; + } + + public String getSelectAllOnFocus_p() { + return selectAllOnFocus_p; + } + + public void setSelectAllOnFocus_p(String selectAllOnFocus_p) { + this.selectAllOnFocus_p = selectAllOnFocus_p; + } + + public String getShadowColor_p() { + return shadowColor_p; + } + + public void setShadowColor_p(String shadowColor_p) { + this.shadowColor_p = shadowColor_p; + } + + public String getShadowDx_p() { + return shadowDx_p; + } + + public void setShadowDx_p(String shadowDx_p) { + this.shadowDx_p = shadowDx_p; + } + + public String getShadowDy_p() { + return shadowDy_p; + } + + public void setShadowDy_p(String shadowDy_p) { + this.shadowDy_p = shadowDy_p; + } + + public String getShadowRadius_p() { + return shadowRadius_p; + } + + public void setShadowRadius_p(String shadowRadius_p) { + this.shadowRadius_p = shadowRadius_p; + } + + public String getSingleLine_p() { + return singleLine_p; + } + + public void setSingleLine_p(String singleLine_p) { + this.singleLine_p = singleLine_p; + } + + public String getText_p() { + return text_p; + } + + public void setText_p(String text_p) { + this.text_p = text_p; + } + + public String getTextAllCaps_p() { + return textAllCaps_p; + } + + public void setTextAllCaps_p(String textAllCaps_p) { + this.textAllCaps_p = textAllCaps_p; + } + + public String getTextAppearance_p() { + return textAppearance_p; + } + + public void setTextAppearance_p(String textAppearance_p) { + this.textAppearance_p = textAppearance_p; + } + + public String getTextColor_p() { + return textColor_p; + } + + public void setTextColor_p(String textColor_p) { + this.textColor_p = textColor_p; + } + + public String getTextColorHighlight_p() { + return textColorHighlight_p; + } + + public void setTextColorHighlight_p(String textColorHighlight_p) { + this.textColorHighlight_p = textColorHighlight_p; + } + + public String getTextColorHint_p() { + return textColorHint_p; + } + + public void setTextColorHint_p(String textColorHint_p) { + this.textColorHint_p = textColorHint_p; + } + + public String getTextColorLink_p() { + return textColorLink_p; + } + + public void setTextColorLink_p(String textColorLink_p) { + this.textColorLink_p = textColorLink_p; + } + + public String getTextCursorDrawable_p() { + return textCursorDrawable_p; + } + + public void setTextCursorDrawable_p(String textCursorDrawable_p) { + this.textCursorDrawable_p = textCursorDrawable_p; + } + + public String getTextFontWeight_p() { + return textFontWeight_p; + } + + public void setTextFontWeight_p(String textFontWeight_p) { + this.textFontWeight_p = textFontWeight_p; + } + + public String getTextIsSelectable_p() { + return textIsSelectable_p; + } + + public void setTextIsSelectable_p(String textIsSelectable_p) { + this.textIsSelectable_p = textIsSelectable_p; + } + + public String getTextScaleX_p() { + return textScaleX_p; + } + + public void setTextScaleX_p(String textScaleX_p) { + this.textScaleX_p = textScaleX_p; + } + + public String getTextSelectHandle_p() { + return textSelectHandle_p; + } + + public void setTextSelectHandle_p(String textSelectHandle_p) { + this.textSelectHandle_p = textSelectHandle_p; + } + + public String getTextSelectHandleLeft_p() { + return textSelectHandleLeft_p; + } + + public void setTextSelectHandleLeft_p(String textSelectHandleLeft_p) { + this.textSelectHandleLeft_p = textSelectHandleLeft_p; + } + + public String getTextSelectHandleRight_p() { + return textSelectHandleRight_p; + } + + public void setTextSelectHandleRight_p(String textSelectHandleRight_p) { + this.textSelectHandleRight_p = textSelectHandleRight_p; + } + + public int getTextSize_p() { + return textSize_p; + } + + public void setTextSize_p(int textSize_p) { + this.textSize_p = textSize_p; + } + + public String getTextStyle_p() { + return textStyle_p; + } + + public void setTextStyle_p(String textStyle_p) { + this.textStyle_p = textStyle_p; + } + + public String getTypeface_p() { + return typeface_p; + } + + public void setTypeface_p(String typeface_p) { + this.typeface_p = typeface_p; + } + + public String getWidth_p() { + return width_p; + } + + public void setWidth_p(String width_p) { + this.width_p = width_p; + } +} diff --git a/banco/app/src/main/java/br/banco/services/app/message/IMessage.java b/banco/app/src/main/java/br/banco/services/app/message/IMessage.java new file mode 100644 index 00000000..75413a81 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/message/IMessage.java @@ -0,0 +1,10 @@ +package br.banco.services.app.message; + +import android.content.Context; + +public interface IMessage { + + public String[] configDesign(Context context); + +} + diff --git a/banco/app/src/main/java/br/banco/services/app/message/Message.java b/banco/app/src/main/java/br/banco/services/app/message/Message.java new file mode 100644 index 00000000..d745d051 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/message/Message.java @@ -0,0 +1,24 @@ +package br.banco.services.app.message; +/* + Mostra as mensagens de sistema: Erro, Internet... +*/ +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/banco/app/src/main/java/br/banco/services/app/message/MessageConfig.java b/banco/app/src/main/java/br/banco/services/app/message/MessageConfig.java new file mode 100644 index 00000000..8d550ae5 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/message/MessageConfig.java @@ -0,0 +1,18 @@ +package br.banco.services.app.message; + +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/banco/app/src/main/java/br/banco/services/app/message/MessageError.java b/banco/app/src/main/java/br/banco/services/app/message/MessageError.java new file mode 100644 index 00000000..4b7e5d11 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/message/MessageError.java @@ -0,0 +1,17 @@ +package br.banco.services.app.message; + +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/banco/app/src/main/java/br/banco/services/app/message/MessageLoad.java b/banco/app/src/main/java/br/banco/services/app/message/MessageLoad.java new file mode 100644 index 00000000..25b5b7e8 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/message/MessageLoad.java @@ -0,0 +1,17 @@ +package br.banco.services.app.message; + +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/banco/app/src/main/java/br/banco/services/app/message/MessageNormal.java b/banco/app/src/main/java/br/banco/services/app/message/MessageNormal.java new file mode 100644 index 00000000..d4928766 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/message/MessageNormal.java @@ -0,0 +1,17 @@ +package br.banco.services.app.message; + +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/banco/app/src/main/java/br/banco/services/app/message/MessageSend.java b/banco/app/src/main/java/br/banco/services/app/message/MessageSend.java new file mode 100644 index 00000000..7460b6a5 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/message/MessageSend.java @@ -0,0 +1,17 @@ +package br.banco.services.app.message; + +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/banco/app/src/main/java/br/banco/services/app/message/MessageSuccess.java b/banco/app/src/main/java/br/banco/services/app/message/MessageSuccess.java new file mode 100644 index 00000000..da94c779 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/message/MessageSuccess.java @@ -0,0 +1,17 @@ +package br.banco.services.app.message; + +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/banco/app/src/main/java/br/banco/services/app/message/MessageType.java b/banco/app/src/main/java/br/banco/services/app/message/MessageType.java new file mode 100644 index 00000000..9b710bbc --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/message/MessageType.java @@ -0,0 +1,49 @@ +package br.banco.services.app.message; +/* +Enumera os tipos de mensagens de sistema + */ +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/banco/app/src/main/java/br/banco/services/app/utils/CharacterCheck.java b/banco/app/src/main/java/br/banco/services/app/utils/CharacterCheck.java new file mode 100644 index 00000000..212d8a14 --- /dev/null +++ b/banco/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/banco/app/src/main/java/br/banco/services/app/utils/ClassDetails.java b/banco/app/src/main/java/br/banco/services/app/utils/ClassDetails.java new file mode 100644 index 00000000..e65f6a80 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/utils/ClassDetails.java @@ -0,0 +1,41 @@ +package br.banco.services.app.utils; + +import android.os.Build; + +public final class ClassDetails { + + private String ClassName; + private String MethodName; + private String MethodType; + + + public ClassDetails(){ + + // this.ClassName = getClass().getName(); + //this.MethodName = getClass().getEnclosingMethod().getName(); + } + + public String getClassName() { + return ClassName; + } + + public void setClassName(String className) { + ClassName = className; + } + + public String getMethodName() { + return MethodName; + } + + public void setMethodName(String methodName) { + MethodName = methodName; + } + + public String getMethodType() { + return MethodType; + } + + public void setMethodType(String methodType) { + MethodType = methodType; + } +} diff --git a/banco/app/src/main/java/br/banco/services/app/utils/CompareClassAndData.java b/banco/app/src/main/java/br/banco/services/app/utils/CompareClassAndData.java new file mode 100644 index 00000000..e46ae53d --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/utils/CompareClassAndData.java @@ -0,0 +1,45 @@ +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/banco/app/src/main/java/br/banco/services/app/utils/CompareClassAndJson.java b/banco/app/src/main/java/br/banco/services/app/utils/CompareClassAndJson.java new file mode 100644 index 00000000..3fc014a6 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/utils/CompareClassAndJson.java @@ -0,0 +1,49 @@ +package br.banco.services.app.utils; + +import android.util.Log; + +import org.json.JSONObject; + +import java.lang.reflect.Field; + +import br.banco.services.fund.data.template.FromFund; + +import static br.banco.services.fund.domain.Configclass.SCREEN_CLASS; + +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/banco/app/src/main/java/br/banco/services/app/utils/Connection.java b/banco/app/src/main/java/br/banco/services/app/utils/Connection.java new file mode 100644 index 00000000..039ecc80 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/utils/Connection.java @@ -0,0 +1,36 @@ + /* + @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 Connection { + + private static int TYPE_WIFI = 1; + private static int TYPE_MOBILE = 2; + private static int TYPE_NOT_CONNECTED = 0; + + public static int getConnectivityStatus(Context context) { + + ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); + + switch (activeNetwork.getSubtype()) + { + + case ConnectivityManager.TYPE_WIFI: + return TYPE_WIFI; + case ConnectivityManager.TYPE_MOBILE: + return TYPE_MOBILE; + default: + return TYPE_NOT_CONNECTED; + + } + } + } diff --git a/banco/app/src/main/java/br/banco/services/app/utils/ConnectionChek.java b/banco/app/src/main/java/br/banco/services/app/utils/ConnectionChek.java new file mode 100644 index 00000000..47764698 --- /dev/null +++ b/banco/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/banco/app/src/main/java/br/banco/services/app/utils/JsonConvert.java b/banco/app/src/main/java/br/banco/services/app/utils/JsonConvert.java new file mode 100644 index 00000000..27c1732a --- /dev/null +++ b/banco/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/banco/app/src/main/java/br/banco/services/app/utils/JsonConvertTypes.java b/banco/app/src/main/java/br/banco/services/app/utils/JsonConvertTypes.java new file mode 100644 index 00000000..174bbab9 --- /dev/null +++ b/banco/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 jsonToList(JSONArray array) throws JSONException { + + List list = new ArrayList(); + + for(int i = 0; i < array.length(); i++) { + Object value = array.get(i); + if(value instanceof JSONArray) { + value = jsonToList((JSONArray) value); + } + + else if(value instanceof JSONObject) { + value = jsonToMap((JSONObject) value); + } + list.add(value); + } + + return list; + } + + public String[] convertToArray(String start){ + String[] resultValue = {}; + + return resultValue; + } + + public ArrayList convertToString(String start){ + ArrayList resultValue = null ; + + return resultValue; + } + +} + + +/* +dataToMap.put("fundName", mainObj.getString("fundName")); +dataToMap.put("whatIs", mainObj.getString("whatIs")); +dataToMap.put("definition", mainObj.getString("definition")); +dataToMap.put("riskTitle", mainObj.getString("riskTitle")); +dataToMap.put("risk", mainObj.getString("risk")); +dataToMap.put("infoTitle", mainObj.getString("infoTitle")); +dataToMap.put("moreInfo", mainObj.getString("moreInfo")); +dataToMap.put("info", mainObj.getString("info")); +dataToMap.put("downInfo", mainObj.getString("downInfo")); +*/ + diff --git a/banco/app/src/main/java/br/banco/services/app/utils/JsonConvertV1.java b/banco/app/src/main/java/br/banco/services/app/utils/JsonConvertV1.java new file mode 100644 index 00000000..e7f6064a --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/utils/JsonConvertV1.java @@ -0,0 +1,94 @@ +package br.banco.services.app.utils; +import android.util.Log; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +public class JsonConvertV1 { + + public ReactAplication RX; + public JsonConvertV1(){ + + + } + + public void startTask(String jsonString) { + + String jsonStr = "{" + + "\"devmovies\":" + + "{" + + "\"filme\":" + + "[" + + "{" + + "\"id\":1," + + "\"titulo\":\"Os Arquivos JSON\"," + + "\"ano\":1998," + + "\"resumo\":\"A história dos arquivos muito leves\"," + + "\"generos\":[\"Ação\",\"Sci-fi\",\"Drama\"]," + + "\"elenco\":[\"Gillian Triggerson\",\"David Markupovny\"]" + + "}," + + "{" + + "\"id\":2," + + "\"titulo\":\"Sexta-feira 13: JSON Vive\"," + + "\"ano\":1986," + + "\"generos\":[\"Ação\",\"Horror\"]," + + "\"elenco\":[\"Ann Labelvalue Pair\", \"Jennifer Json\", \"John Java\"]" + + "}" + + "]" + + "}" + + "}"; + + + try { + + + JSONObject devMovies = new JSONObject(jsonStr); + JSONObject filmes = devMovies.getJSONObject("devmovies"); + JSONArray arrFilmes = filmes.getJSONArray("filme"); + + + for (int i = 0; i < arrFilmes.length(); i++) { + + //recupera filme de índice "i" no array + JSONObject f = ((JSONArray) arrFilmes).getJSONObject(i); + + System.out.println("id: " + f.getInt("id")); + System.out.println("titulo: " + f.getString("titulo")); + System.out.println("ano: " + f.getInt("ano")); + + Log.d("FUND","resumo: " + f.optString("resumo", "-")); + + //gêneros + JSONArray arrGeneros = f.getJSONArray("generos"); + for (int k = 0; k < arrGeneros.length(); k++) { + Log.d("FUND", "genero " + (k + 1) + ": " + arrGeneros.getString(k)); + } + + //elenco + System.out.println("elenco: "); + + JSONArray arrAtores = f.getJSONArray("elenco"); + for (int j = 0; j < arrAtores.length(); j++) { + Log.d( "TAG", "\t" + arrAtores.getString(j)); + } + + System.out.println(); + + } // for + + RX.onNext("SUCESSO"); + }catch(JSONException e){ + RX.onError(e); + } + catch (Exception e){ + RX.onError(e); + } + + } + + + + + +} diff --git a/banco/app/src/main/java/br/banco/services/app/utils/Layout.java b/banco/app/src/main/java/br/banco/services/app/utils/Layout.java new file mode 100644 index 00000000..1a44f40a --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/utils/Layout.java @@ -0,0 +1,14 @@ +package br.banco.services.app.utils; + +import android.util.Log; + +public final class Layout { + + + public void showLog(String tag, String event){ + + Log.d(tag, " -> "+getClass().getName()+" -> " + event) ; + } + + +} diff --git a/banco/app/src/main/java/br/banco/services/app/utils/Orientation.java b/banco/app/src/main/java/br/banco/services/app/utils/Orientation.java new file mode 100644 index 00000000..b227f4c6 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/utils/Orientation.java @@ -0,0 +1,51 @@ +package br.banco.services.app.utils; + +public class Orientation { + + int orientation; + int horizontal; + int vertical; + int blok; + + public int getOrientation() { + // int currentOrientation = getResources().getConfiguration().orientation; + return orientation; + } + + public void setOrientation(int orientation) { + // setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); + this.orientation = orientation; + } + + public int getHorizontal() { + return horizontal; + } + + public void setHorizontal(int horizontal) { + this.horizontal = horizontal; + } + + public int getVertical() { + return vertical; + } + + public void setVertical(int vertical) { + this.vertical = vertical; + } + + + + public void setBlok(int blok) { + /* + int currentOrientation = getResources().getConfiguration().orientation; + if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); + } + else { + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); + } + */ + + this.blok = blok; + } +} diff --git a/banco/app/src/main/java/br/banco/services/app/utils/Preferences.java b/banco/app/src/main/java/br/banco/services/app/utils/Preferences.java new file mode 100644 index 00000000..ebae5ba4 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/utils/Preferences.java @@ -0,0 +1,30 @@ + /* + @fazer + implementar + */ + +package br.banco.services.app.utils; +import android.content.Context; +import android.content.SharedPreferences; + + public class Preferences { + + + public static final String LOGGED = "logged"; + + private SharedPreferences mSharedPreferences; + private Context mContext; + + public Preferences(Context aContex){ + mContext = aContex; + mSharedPreferences = mContext.getSharedPreferences("settings", Context.MODE_PRIVATE); + } + + public boolean getBoolean(String aKey){ + return mSharedPreferences.getBoolean(aKey, false); + } + + public void setBoolean(String aKey, boolean aValue){ + mSharedPreferences.edit().putBoolean(aKey,aValue).commit(); + } + } diff --git a/banco/app/src/main/java/br/banco/services/app/utils/ReactAplication.java b/banco/app/src/main/java/br/banco/services/app/utils/ReactAplication.java new file mode 100644 index 00000000..d749ae4d --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/utils/ReactAplication.java @@ -0,0 +1,65 @@ +package br.banco.services.app.utils; + +import android.util.Log; + + +public class ReactAplication { + + + public void onCompleted(){ + + try{ + + Log.e("FUND", "onError: "); + + }catch (Exception ex){ + Log.d("FUND", "onCompleted: ERROR ONNEX: " + ex.getMessage() ); + } + + } + + public void onError(Throwable e){ + + try{ + + // StackTraceElement[] s = Thread.currentThread().getStackTrace(); + // StackTraceElement e = s[3]; + // String c = e.getClassName(); + // String m = e.getMethodName(); + + String message = "-> CLASS: " + e.getStackTrace()[2].getClassName() + + " -> METHOD: " + e.getStackTrace()[2].getMethodName() + + "-> ERROR"+ e.getMessage() + + ""; + Log.e("FUND", "onError: " + message); + + }catch (Exception ex){ + Log.d("FUND", "onNext: ERROR ONNEX: " + ex.getMessage() ); + } + + } + + public void onNext(String message){ + + try{ + + StackTraceElement[] s = Thread.currentThread().getStackTrace(); + StackTraceElement e = s[3]; + + if(e.getMethodName().equals("")){ e = s[1]; } + //if(e!=null){ e = s[2]; } + + String c = e.getClassName(); + String m = e.getMethodName(); + + Log.d("FUND", "onNext: " + m + " -> " + message +" -> " + c ); + // Delegate.onError(String Message) + + }catch (Exception ex){ + Log.d("FUND", "onNext: ReactAplication ERROR: " + ex.getMessage() ); + } + + + } +} + diff --git a/banco/app/src/main/java/br/banco/services/app/utils/ScreenSizes.java b/banco/app/src/main/java/br/banco/services/app/utils/ScreenSizes.java new file mode 100644 index 00000000..a21aba48 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/utils/ScreenSizes.java @@ -0,0 +1,41 @@ +package br.banco.services.app.utils; + +import android.app.Activity; +import android.content.Context; +import android.util.DisplayMetrics; + +public final class ScreenSizes extends Activity { + + private int width = 0; + private int height = 0; + + //Activity activity = new Activity().getParent(); + + public ScreenSizes(Activity activity,Context context){ + + DisplayMetrics displayMetrics = new DisplayMetrics(); + activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); + //((Activity)context).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); + this.height = displayMetrics.heightPixels; + this.width = displayMetrics.widthPixels; + + } + + public int getWidth() { + return width; + } + + public void setWidth(int width) { + this.width = width; + } + + public int getHeight() { + return height; + } + + public void setHeight(int height) { + this.height = height; + } + + +} diff --git a/banco/app/src/main/java/br/banco/services/app/utils/ValidatorEmail.java b/banco/app/src/main/java/br/banco/services/app/utils/ValidatorEmail.java new file mode 100644 index 00000000..1f053cda --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/utils/ValidatorEmail.java @@ -0,0 +1,44 @@ + +package br.banco.services.app.utils; + +import java.util.regex.Pattern; + + +public class ValidatorEmail {// implements TextWatcher + + private boolean mIsValid = false; + + public static final Pattern EMAIL_PATTERN = Pattern.compile( + "[a-zA-Z0-9\\+\\.\\_\\%\\-\\+]{1,256}" + + "\\@" + + "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}" + + "(" + + "\\." + + "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" + + ")+" + ); + + + + public boolean isValid() { + return mIsValid; + } + + + public static boolean isValidEmail(CharSequence email) { + return email != null && EMAIL_PATTERN.matcher(email).matches(); + } + + /* + @Override + final public void afterTextChanged(Editable editableText) { + mIsValid = isValidEmail(editableText); + } + + @Override + final public void beforeTextChanged(CharSequence s, int start, int count, int after) {} + + @Override + final public void onTextChanged(CharSequence s, int start, int before, int count) {} + */ +} diff --git a/banco/app/src/main/java/br/banco/services/app/utils/ValidatorName.java b/banco/app/src/main/java/br/banco/services/app/utils/ValidatorName.java new file mode 100644 index 00000000..f2b4dfd9 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/utils/ValidatorName.java @@ -0,0 +1,80 @@ +package br.banco.services.app.utils; +/* + CERTO: Jose Silva Santos + ERRADO: Jose da Silva Santos + +*/ + +import java.util.regex.Pattern; + +public class ValidatorName { //implements TextWatcher + + //private boolean isValidName = false; + + public static final Pattern USER_NAME = Pattern.compile( + "[a-zA-ZA-z\\-\\+]{1,50}" + ); + + + public static boolean haveWords(String strName) { + try { + + if(strName != null) { + strName = strName.replace(" ","").trim(); + } + + return USER_NAME.matcher(strName).matches(); + + } catch (Exception e) { + return false; + } + } + + public static boolean haveSize(String strName) { + try { + return strName != null + && strName.length() > 1 + && strName.length() < 25 + ; + + } catch (Exception e) { + return false; + } + } + + public static boolean haveParts(String strName){ + try { + + String[] parts = {}; + if(strName != null) { + strName = (strName.trim()); + parts = strName.split(" "); + } + + return (parts.length > 1 && parts.length < 5) ; + + } catch (Exception e) { + return false; + } + + } + + public static boolean isValidName(String strName) { + + //return ( haveWords(strName) ); + return ( haveWords(strName) && haveSize(strName) && haveParts(strName) ); + } + + /* + @Override + final public void afterTextChanged(Editable editableText) { + } + + @Override + final public void beforeTextChanged(CharSequence s, int start, int count, int after) {} + + @Override + final public void onTextChanged(CharSequence s, int start, int before, int count) {} + */ + +} diff --git a/banco/app/src/main/java/br/banco/services/app/utils/ValidatorPhone.java b/banco/app/src/main/java/br/banco/services/app/utils/ValidatorPhone.java new file mode 100644 index 00000000..e2b645a0 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/utils/ValidatorPhone.java @@ -0,0 +1,44 @@ +package br.banco.services.app.utils; + +import java.util.regex.Pattern; + +/* +FEITO: 0000000000 / telefone com 10 digitos +@FAZER: Formatar (00)0000-0000 + */ +public class ValidatorPhone { //implements TextWatcher + + private boolean misValid = false; + public static final Pattern USER_NAME = Pattern.compile( + "[0-9\\-\\+]{10,13}" + ); + + public static boolean isPhoneNumeric(String strTelefone) { + try { + + String removeSpace = strTelefone.replace(" ","").trim(); + return strTelefone != null && USER_NAME.matcher(strTelefone).matches(); + + }catch (NumberFormatException nfe) { + return false; + }catch (NullPointerException npe) { + return false; + } + } + + public boolean isValid() { + return misValid; + } + + /* + @Override + final public void afterTextChanged(Editable editableText) { + } + @Override + final public void beforeTextChanged(CharSequence s, int start, int count, int after) {} + + @Override + final public void onTextChanged(CharSequence s, int start, int before, int count) {} + */ + +} diff --git a/banco/app/src/main/java/br/banco/services/app/utils/ValidatorURL.java b/banco/app/src/main/java/br/banco/services/app/utils/ValidatorURL.java new file mode 100644 index 00000000..2aeb09fd --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/utils/ValidatorURL.java @@ -0,0 +1,31 @@ + +package br.banco.services.app.utils; + +import java.util.regex.Pattern; + + +public class ValidatorURL {// + + private boolean mIsValid = false; + + public static final Pattern URL_PATTERN = Pattern.compile( + + "[a-zA-Z0-9\\+\\.\\_\\%\\-\\+]{1,256}" + + + "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}" + + "(" + + "\\." + + "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" + + ")+" + ); + + public boolean isValid() { + return mIsValid; + } + + + public static boolean isValidURL(CharSequence urlChek) { + return urlChek != null && URL_PATTERN.matcher(urlChek).matches(); + } + +} diff --git a/banco/app/src/main/java/br/banco/services/app/utils/Version.java b/banco/app/src/main/java/br/banco/services/app/utils/Version.java new file mode 100644 index 00000000..b6e36b41 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/app/utils/Version.java @@ -0,0 +1,17 @@ +package br.banco.services.app.utils; + +import android.os.Build; + +public final class Version { + + private final String osRelease = Build.VERSION.RELEASE; + private final int sdkVersion = Build.VERSION.SDK_INT; + + public String getOsRelease() { + return osRelease; + } + + public int getSdkVersion() { + return sdkVersion; + } +} diff --git a/banco/app/src/main/java/br/banco/services/contact/Contact.java b/banco/app/src/main/java/br/banco/services/contact/Contact.java new file mode 100644 index 00000000..2348a824 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/Contact.java @@ -0,0 +1,92 @@ +package br.banco.services.contact; + +/* + @FAZER: Implementar o Parcelable por reduzir gasto de memoria + */ + +//import android.os.Parcelable; +import android.util.Log; + +import java.io.Serializable; +import java.util.ArrayList; + +public class Contact implements Serializable { + + private String FullName; + private String Email; + private Long Phone; + private int EmailSave; + + public Contact() { + // this.FullName = FullName; + // this.Email = Email; + // this.Phone = Phone; + // this.EmailSave = EmailSave; + } + + public String getFullName() { + return FullName; + } + + public void setFullName(String FullName) { + this.FullName = FullName; + } + + public String getEmail() { + return Email; + } + + public void setEmail(String Email) { + this.Email = Email; + } + + public Long getPhone() { + return Phone; + } + + public void setPhone(Long phone) { + Phone = phone; + } + + + public int getEmailSave() { + return EmailSave; + } + + public void setEmailSave(int emailSave) { + EmailSave = emailSave; + } + + public void showValues(String TAG, String FUNCTION, ArrayList listValues){ + + Log.i(TAG, "@TAG: " + TAG + " / " + FUNCTION); + + if(listValues.size()==4 || TAG != null) { + Log.i(TAG, "FullName = " + listValues.get(0)); + Log.i(TAG, "Email = " + listValues.get(1)); + Log.i(TAG, "Phone = " + listValues.get(2)); + Log.i(TAG, "EmailSave = " + listValues.get(3)); + }else{ + Log.e(TAG, "Erro: @TAG: " + TAG + " / " + FUNCTION + " lista incompleta!" ); + } + } + + public void showObjetc(String TAG, String FUNCTION, Contact contact){ + + Log.i(TAG, "@TAG: " + TAG + " / " + FUNCTION); + + if( contact!=null && TAG != null) { + + Log.d(TAG, " c.getFullName() = " + contact.getFullName()); + Log.d(TAG, " c.getFullName() = " + contact.getEmail()); + Log.d(TAG, " c.getFullName() = " + contact.getPhone()); + Log.d(TAG, " c.getFullName() = " + contact.getEmailSave()); + + }else{ + Log.e(TAG, "Erro: @TAG: " + TAG + " / " + FUNCTION + " objeto nulo!" ); + } + } + + +} + \ No newline at end of file diff --git a/banco/app/src/main/java/br/banco/services/contact/ContactModel.java b/banco/app/src/main/java/br/banco/services/contact/ContactModel.java new file mode 100644 index 00000000..c30619fd --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/ContactModel.java @@ -0,0 +1,27 @@ +package br.banco.services.contact; + +// area, titulo, mensagem, botao texto, botao estilo + +public class ContactModel implements IContactImpl.ModelImpl { + + + public ContactModel(){ + + // do action + } + + @Override + public void savePreferecnces(Contact contactForm){ + // Log.d("CONTACT", " / MODEL / savePreferecnces -> SUCCESS " ); + }; + + @Override + public void clearferecnces(Contact contactForm){ + // Log.d("CONTACT", " / clearferecnces -> SUCCESS " ); + }; + + //public void updateContact(){} + //public void readContact(){} + //public void deleteContact(){} + +} diff --git a/banco/app/src/main/java/br/banco/services/contact/ContactPresenter.java b/banco/app/src/main/java/br/banco/services/contact/ContactPresenter.java new file mode 100644 index 00000000..6b87b3bf --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/ContactPresenter.java @@ -0,0 +1,40 @@ +package br.banco.services.contact; + +/* + @FAZER: Gravar preferencias, Banco de Dados, etc + */ + +import android.content.Context; + +import java.util.ArrayList; + +public class ContactPresenter implements IContactImpl.PresenterImpl { + + private String TAG = "CONTACT"; + + private Contact contact; + private IContactImpl.ModelImpl modelImpl; + private IContactImpl.ViewImpl viewImpl; + + public ContactPresenter(IContactImpl.ViewImpl views) { + + modelImpl = new ContactModel(); + contact = new Contact(); + this.viewImpl = views; + } + + public Context getContext() { + return (Context) viewImpl; + } + + public void sendForm(Contact contactForm){ + + modelImpl.savePreferecnces(contactForm); + // viewImpl.sendFormView(contactForm); + viewImpl.sendFormView2(contactForm); + + // contact.showObjetc(TAG, getClass().getName() + "drawFormView" ,contactForm); + } + + +} diff --git a/banco/app/src/main/java/br/banco/services/contact/ContactSendPresenter.java b/banco/app/src/main/java/br/banco/services/contact/ContactSendPresenter.java new file mode 100644 index 00000000..f1c7e2d2 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/ContactSendPresenter.java @@ -0,0 +1,67 @@ +package br.banco.services.contact; + +import android.content.Context; +import android.util.Log; + +import br.banco.services.app.alert.Alert; +import br.banco.services.app.message.IMessage; +import br.banco.services.app.message.MessageType; +import br.banco.services.contact.message.ContactSenderType; +import br.banco.services.contact.message.IContactMsg; + + +public class ContactSendPresenter { + + private Alert alert; + private View view; + + public ContactSendPresenter(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); + + // Log.d("CONTACT"," / loadAlertView -> SUCESS -> msgCode TESTE = " + msgCode); + } + + + public void loadAlertContactView(int msgCode, Context context){ + + msgCode = (msgCode == 0 || msgCode == 1 ) ? msgCode : 0; + + //ContactSenderType type = ContactSenderType.ERROR; + ContactSenderType type = ContactSenderType.values()[msgCode]; + + IContactMsg message = type.returnMessage(); + String[] alertValues = message.configDesign(context); + + view.updateAlertView(alertValues); + } + + + public interface View{ + + boolean checkInternet(); + void drawView(); + void updateAlertView(String alertValues[]); + + // boolean sendEmailTask(); + + void initProgressBar(); + void showProgressBar(); + void hideProgressBar(); + + } + + + +} diff --git a/banco/app/src/main/java/br/banco/services/contact/ContactSendView.java b/banco/app/src/main/java/br/banco/services/contact/ContactSendView.java new file mode 100644 index 00000000..541e14e2 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/ContactSendView.java @@ -0,0 +1,370 @@ + /* + + INTENET > INTENT > BUNDLE > EMAIL + + */ + +package br.banco.services.contact; + +import android.graphics.Color; +import android.graphics.PorterDuff; +import android.os.AsyncTask; +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 java.util.ArrayList; +import java.util.List; + +import javax.mail.MessagingException; + +import br.banco.services.R; +import br.banco.services.app.utils.ConnectionChek; +//import br.banco.services.contact.message.ContactMsgView; +import br.banco.services.contact.message.GMailSenderV2; + + + public class ContactSendView extends AppCompatActivity implements ContactSendPresenter.View { + + public String TAG = "CONTACT"; + private ContactSendPresenter presenter; + public GMailSenderV2 emailSender ; + + private int messageCode = 0; + private ConnectionChek internet; + private Handler handler; + + private Contact contactTest; + private ArrayList listSendMail ; + + + 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); + + presenter = new ContactSendPresenter(this); + + drawView(); + initProgressBar(); + showProgressBar(); + + + if(checkInternet()){ + + presenter = new ContactSendPresenter(this); + presenter.loadAlertView(messageCode, getApplicationContext()); + + String keyName = "contactData"; // reutilizavel + listSendMail = new ArrayList(); + //listSendMail.addAll( receiveIntentView(keyName) !=null ); + listSendMail = ( receiveIntentView(keyName) ); + + if(listSendMail != null && listSendMail.size() == 1 ){ + + messageCode = 5; // not send + presenter.loadAlertView(messageCode, getApplicationContext()); + + String TESTE = "testando"; + + new sendEmailTask().execute(listSendMail); + + Log.d(TAG, " VIEW / "+getClass().getName()+" / listSendMail -> SUCCESS"); + + }else{ + + Log.d(TAG, "VIEW / "+getClass().getName()+" / listSendMail -> ERROR"); + } + + }else{ + + messageCode = 2; // not connected + presenter.loadAlertView(messageCode, getApplicationContext()); + + Log.d(TAG, "VIEW "+getClass().getName()+" / onCreate -> ERROR " ); + } + + //Log.d(TAG, " / onCreate -> getIntent -> messageCode = " + messageCode) ; + + } + + + + @Override + public void onResume() { + super.onResume(); + if(messageCode == 5) { + // caso mensagem enviada voltar ao Splash + // presenter.loadAlertView(messageCode, getApplicationContext()); + Log.d(TAG, "VIEW / "+getClass().getName()+" / onResume -> EXIT " ); + } + + } + + + + 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; + } + + } + + + private ArrayList receiveIntentView(String keyName){ + + ArrayList listContact = new ArrayList(); + listContact = null; + + if(getIntent().getExtras() != null){ + Bundle bundle = getIntent().getExtras(); + + if(bundle.getSerializable("contactData") != null){ + + try { + + listContact = (ArrayList) bundle.getSerializable(keyName); + + //contactTest.showObjetc(TAG, getClass().getName() + " / onCreate", listContact); + //contactTest.showValues(TAG, getClass().getName() + " / onCreate", listContact); + + Log.d(TAG, " VIEW / receiveIntentView -> SUCCESS"); + + }catch (Exception e){ + Log.d(TAG, "VIEW / receiveIntentView -> ERROR = " + e.getMessage() ); + } + } + } + + //listContact = null; + return listContact; + } + + public class sendEmailTask extends AsyncTask, Void, ResponseMail> { + + protected void onPreExecute() { + + Log.e(TAG,"VIEW / sendEmailTask -> INICIO"); + showProgressBar(); + + } + + @Override + protected ResponseMail doInBackground(ArrayList... contactList) { + + try { + + emailSender = new GMailSenderV2(); + ArrayList resultList = new ArrayList(); + + // carregar da string XML + //getResources().getString(R.string.adress_email_title); + + String emailTitle = "TITULO DA MENSAGEM"; + String emailBody ="CORPO DA MENSAGEM"; + String emailTo ="busqe.irece@gmail.com"; + String emailCopy ="adrianosouzai@gmail.com"; + + if(contactList.length > 0) { + + resultList = contactList[0]; + + if(resultList.get(0) !=null ) { + + String emailSave = ""; + emailSave = (resultList.get(0).getEmailSave() == 1) ? "SIM" : "NAO"; + + emailBody = "CORPO DA MENSAGEM: \n\n" + + "NOME: " + resultList.get(0).getFullName()+ "\n" + + "EMAIL: " + resultList.get(0).getEmail() + "\n" + + "PHONE: " + resultList.get(0).getPhone() + "\n" + + "SALVAR EMAIL: " + emailSave + "\n" + + ""; + }else{ + emailBody ="Mensagem com vazia!"; + } + + }else{ + emailBody ="Mensagem com erros!"; + } + + Log.e(TAG, "VIEW / emailBody = " + emailBody ); + + // converer classe em boolean + emailSender.sendMail(emailTitle, emailBody,emailTo,emailCopy); + + + } catch (MessagingException e) { + Log.e(TAG, "VIEW / sendEmailView -> ERROR = " + e.fillInStackTrace()); + throw new RuntimeException(e); + + } catch (Exception e) { + Log.e(TAG, "VIEW / sendEmailView - ERROR = " + e.fillInStackTrace()); + + } + + return null; + } + + @Override + protected void onPostExecute(ResponseMail response) { + + messageCode = 1; // not send + presenter.loadAlertContactView(messageCode, getApplicationContext()); + + Log.e(TAG,"VIEW / sendEmailTask -> FINAL"); + hideProgressBar(); + } + + } + + public class ResponseMail { + + private List lista = new ArrayList(); + + public List mLista() { + return lista; + } + + + } + + + + + + + @Override + public void updateAlertView(String[] alertValues) { + + + tvArea.setText(alertValues[0]); + tvTitle.setText(alertValues[1]); + tvMessage.setText(alertValues[2]); + btAction.setText(alertValues[3]); + + // String buttonStyle = alertValues[4]; + + switch (messageCode){ + + case 0: + showProgressBar(); // LOAD + break; + case 1: + hideProgressBar(); // + break; + case 2: + hideProgressBar(); // + break; + case 3: + hideProgressBar(); // + break; + case 4: + hideProgressBar(); // + break; + default: + hideProgressBar(); // ERROR + break; + + } + + if(alertValues[4].equals("elementInvible")){ + btAction.setBackgroundResource( R.drawable.shape_circle_light); + btAction.setTextColor(Color.parseColor("#333333")); + } + + + Log.d(TAG," VIEW / updateAlertView -> SUCESS -> alertValues"); + } + + @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); + } + + @Override + public 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/banco/app/src/main/java/br/banco/services/contact/ContactView.java b/banco/app/src/main/java/br/banco/services/contact/ContactView.java new file mode 100644 index 00000000..b074bf35 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/ContactView.java @@ -0,0 +1,309 @@ + /* + + @FAZER: usar Stragy Patern + FLUXO: + + */ + +package br.banco.services.contact; + + import android.content.Context; + import android.content.Intent; + import android.graphics.Color; + import android.os.Bundle; + import android.support.constraint.ConstraintLayout; + import android.support.v7.app.AppCompatActivity; + import android.text.Editable; + import android.text.TextWatcher; + import android.util.Log; + import android.view.KeyEvent; + import android.view.View; + import android.widget.Button; + import android.widget.CheckBox; + import android.widget.CompoundButton; + import android.widget.ProgressBar; + import android.widget.EditText; + import android.widget.TextView; + + import java.io.Serializable; + import java.util.ArrayList; + + import br.banco.services.R; + import br.banco.services.app.utils.CharacterCheck; + import br.banco.services.app.utils.ValidatorEmail; + import br.banco.services.app.utils.ValidatorName; + import br.banco.services.app.utils.ValidatorPhone; + + import br.banco.services.contact.message.ContactMsgView; + + + public class ContactView extends AppCompatActivity implements + IContactImpl.ViewImpl, + View.OnClickListener + { + + public String TAG = "CONTACT"; + public int option = 0; + + private Contact contactTest; + public ArrayList listFormItens; + private ArrayList listFormContact ; + + private static IContactImpl.PresenterImpl presenter; + + public ConstraintLayout constraintLayout; + public EditText vFullName ; + public EditText vEmail; + public EditText vPhone; + public CheckBox vEmailSave; + public Button vBtSend; + private ProgressBar progressBar; + + private boolean isValidName = false; + private boolean isValidEmail = false; + private boolean isValidPhone = false; + + private Intent intentSendData; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_contact_form); + + contactTest = new Contact(); + presenter = new ContactPresenter(this); + + drawFormView(); + drawNavigation(); + + // presenter.loadView(option, getApplicationContext()); + + checkTyping(vFullName); + checkTyping(vEmail); + checkTyping(vPhone); + + + + + } + + @Override + public void onResume() { + super.onResume(); + + } + + + // @Override + public void drawFormView(){ + + vFullName = (EditText) findViewById(R.id.etFullName); + vEmail = (EditText) findViewById(R.id.etEmail); + vPhone = (EditText) findViewById(R.id.etPhone); + vEmailSave =(CheckBox) findViewById(R.id.cbEmailAccept); + vBtSend = (Button) findViewById(R.id.btSend); + + // int isChecked = (vEmailSave.isChecked()) ? 1 : 0; + + vEmailSave.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + + if (isChecked) { + + // vEmailSave.setBackgroundColor(Color.RED); + //vEmailSave.setButtonDrawable(R.drawable.shape_button_dark); + } + else + { + //vEmailSave.setButtonDrawable(R.drawable.shape_button_light); + // vEmailSave.setBackgroundColor(Color.GRAY); + } + + + } + }); + + vBtSend.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + + checkFormValuesView(); + + // contactTest.showObjetc(TAG, getClass().getName() + "drawFormView" ,contactTest); + //contactTest.showValues(TAG,getClass().getName() + " / sendFormView",listFormItens); + + if(isValidName && isValidEmail && isValidPhone){ + + presenter.sendForm(contactTest); + + }else{ + Log.d(TAG, " / drawFormView -> drawAlert"); + } + + } + }); + } + + public void drawFormAlert(final TextView viewt){ + // Log.d(TAG, "ERRO: DADOS VAZIOS"); + } + + public void sendFormView2(Contact contactForm){ + + + ArrayList contactData = new ArrayList(); + contactData.add(contactForm); + + Intent intent = new Intent(this, ContactSendView.class); + Bundle bundle = new Bundle(); + + bundle.putSerializable("contactData",(Serializable)contactData); + intent.putExtras(bundle); + startActivity(intent); + + overridePendingTransition(R.anim.an_sair, R.anim.an_entrar); + + clearFormTextView(); + //finish(); + + // contactTest.showObjetc(TAG, getClass().getName() + "drawFormView" ,contactForm); + + Log.d(TAG, " VIEW / sendFormView2 -> SUCCESS" ); + } + + public void sendFormView(Contact contactForm){ + + Log.d(TAG, " / sendFormView -> SUCCESS" ); + + ArrayList contactData = new ArrayList(); + contactData.add(contactForm); + + Intent intent = new Intent(this, ContactMsgView.class); + Bundle bundle = new Bundle(); + + bundle.putSerializable("contactData",(Serializable)contactData); + intent.putExtras(bundle); + startActivity(intent); + + overridePendingTransition(R.anim.an_sair, R.anim.an_entrar); + + // clearFormTextView(); + //finish(); + + // contactTest.showObjetc(TAG, getClass().getName() + "drawFormView" ,contactForm); + } + + public void checkTyping(final TextView view){ + + view.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) {} + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + // String elementId = getResources().getResourceEntryName(view.getId()); + checkFormValuesView(); // checkFormValuesView(elementId) + + } + + @Override + public void afterTextChanged(Editable s) { + //Log.d(TAG, "afterTextChanged === " + isValidEmail); + } + }); + + } + + public void checkFormValuesView(){ + + ValidatorName ValidatorName = new ValidatorName(); + ValidatorEmail validatorEmail = new ValidatorEmail(); + ValidatorPhone validatorPhone = new ValidatorPhone(); // depends: isValidPhone + // isChecked = bool + + String testName = vFullName.getText().toString().trim(); + String testEmail = vEmail.getText().toString().trim(); + String testPhone = vPhone.getText().toString().trim(); + int isChecked = (vEmailSave.isChecked()) ? 1 : 0; + // boolean isChecked = vEmailSave.isChecked(); + + isValidName = ValidatorName.isValidName(testName); + isValidEmail = validatorEmail.isValidEmail(testEmail); + isValidPhone = validatorPhone.isPhoneNumeric(testPhone); + + CharacterCheck characterCheck = new CharacterCheck(); + Long phoneNumber = characterCheck.getIsLong(testPhone); + isValidPhone = (phoneNumber >= 1000000000); //10 digits + + contactTest.setFullName(testName); + contactTest.setEmail(testEmail); + contactTest.setPhone(phoneNumber); + contactTest.setEmailSave(isChecked); + + //contactTest.showObjetc(TAG, getClass().getName() + " / drawFormView" , contactTest); + + } + + public void clearFormTextView(){ + + // checar internet antes de limpar o form + vFullName.setText(""); + vEmail.setText(""); + vPhone.setText(""); + vEmailSave.setChecked(false); + + } + + @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); + } + + + @Override + public void onClick(View view) { + + Intent IT; + Context context = getApplicationContext(); + + switch (view.getId()) { + + case R.id.btAction1: + IT = new Intent(this, br.banco.services.fund.option.FundOptionView.class); + startActivity(IT); + overridePendingTransition(R.anim.an_entrar_esquerda,R.anim.an_sair_esquerda); + break; + /* + case R.id.btAction2: + IT = new Intent(this, br.banco.services.contact.ContactView.class); + startActivity(IT); + overridePendingTransition(R.anim.an_entrar_esquerda,R.anim.an_sair_esquerda); + break; + */ + + } + + } + + public void drawNavigation(){ + Button BTAction1 = (Button) findViewById(R.id.btAction1); + Button BTAction2 = (Button) findViewById(R.id.btAction2); + BTAction1.setOnClickListener(this); + BTAction2.setOnClickListener(this); + } + + + + + + } diff --git a/banco/app/src/main/java/br/banco/services/contact/IContactImpl.java b/banco/app/src/main/java/br/banco/services/contact/IContactImpl.java new file mode 100644 index 00000000..2226192e --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/IContactImpl.java @@ -0,0 +1,30 @@ + package br.banco.services.contact; + +import android.widget.TextView; + +public interface IContactImpl { + + interface PresenterImpl{ + void sendForm(Contact contact); + } + + interface ModelImpl{ + void savePreferecnces(Contact contactForm); + void clearferecnces(Contact contactForm); + } + interface ViewImpl{ + + // start + void drawFormView(); + + // process + void checkTyping(final TextView view); + void checkFormValuesView(); + + // final + void sendFormView(Contact contactForm); + void sendFormView2(Contact contactForm); + void clearFormTextView(); + } + +} diff --git a/banco/app/src/main/java/br/banco/services/contact/data/IContact.java b/banco/app/src/main/java/br/banco/services/contact/data/IContact.java new file mode 100644 index 00000000..d9acf63c --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/data/IContact.java @@ -0,0 +1,10 @@ +package br.banco.services.contact.data; + +import android.content.Context; + +public interface IContact { + + public String configDesign(Context context); + +} + diff --git a/banco/app/src/main/java/br/banco/services/contact/data/local/FromDatabase.java b/banco/app/src/main/java/br/banco/services/contact/data/local/FromDatabase.java new file mode 100644 index 00000000..7e860454 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/data/local/FromDatabase.java @@ -0,0 +1,22 @@ +package br.banco.services.contact.data.local; + +import android.content.Context; +import android.support.v7.app.AppCompatActivity; + +import br.banco.services.R; +import br.banco.services.contact.data.IContact; +import br.banco.services.fund.data.IFundData; + +public class FromDatabase extends AppCompatActivity implements IContact { + + private Context b; + + public String configDesign(Context a) { + // this.b = a; + return "{'cells':[{'id':1,'type':2,'message':'Olá,primeiroseapresentecomoseunome:','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':'Gostariadecadastrarmeuemail','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}]}"; + } + + + + +} diff --git a/banco/app/src/main/java/br/banco/services/contact/data/local/FromPreferences.java b/banco/app/src/main/java/br/banco/services/contact/data/local/FromPreferences.java new file mode 100644 index 00000000..4caf5b57 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/data/local/FromPreferences.java @@ -0,0 +1,19 @@ +package br.banco.services.contact.data.local; + +import android.content.Context; +import android.support.v7.app.AppCompatActivity; + +import br.banco.services.R; +import br.banco.services.contact.data.IContact; +import br.banco.services.fund.data.IFundData; + +public class FromPreferences extends AppCompatActivity implements IContact { + + private Context b; + + public String configDesign(Context a) { + // this.b = a; + return "{'cells':[{'id':1,'type':2,'message':'Olá,primeiroseapresentecomoseunome:','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':'Gostariadecadastrarmeuemail','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}]}"; + } + +} diff --git a/banco/app/src/main/java/br/banco/services/contact/data/local/FromType.java b/banco/app/src/main/java/br/banco/services/contact/data/local/FromType.java new file mode 100644 index 00000000..02282b88 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/data/local/FromType.java @@ -0,0 +1,30 @@ +package br.banco.services.contact.data.local; + +import android.content.Context; +import android.support.v7.app.AppCompatActivity; + +import br.banco.services.contact.data.IContact; + + + +public enum FromType { + + DATABASE { + @Override + public IContact returnMessage() { + return new FromPreferences(); + } + }, + PREERENCES { + @Override + public IContact returnMessage() { + return new FromDatabase(); + } + } + + ; + + public abstract IContact returnMessage(); + +} + diff --git a/banco/app/src/main/java/br/banco/services/contact/data/remote/FromInternational.java b/banco/app/src/main/java/br/banco/services/contact/data/remote/FromInternational.java new file mode 100644 index 00000000..a7a81ca1 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/data/remote/FromInternational.java @@ -0,0 +1,17 @@ +package br.banco.services.contact.data.remote; + +import android.content.Context; +import android.support.v7.app.AppCompatActivity; + +import br.banco.services.contact.data.IContact; + +public class FromInternational extends AppCompatActivity implements IContact { + + private Context b; + + public String configDesign(Context a) { + // this.b = a; + return "{'cells':[{'id':1,'type':2,'message':'Olá,primeiroseapresentecomoseunome:','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':'Gostariadecadastrarmeuemail','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}]}"; + } + +} diff --git a/banco/app/src/main/java/br/banco/services/contact/data/remote/FromNational.java b/banco/app/src/main/java/br/banco/services/contact/data/remote/FromNational.java new file mode 100644 index 00000000..509118b8 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/data/remote/FromNational.java @@ -0,0 +1,17 @@ +package br.banco.services.contact.data.remote; + +import android.content.Context; +import android.support.v7.app.AppCompatActivity; + +import br.banco.services.contact.data.IContact; + +public class FromNational extends AppCompatActivity implements IContact { + + private Context b; + + public String configDesign(Context a) { + // this.b = a; + return "{'cells':[{'id':1,'type':2,'message':'Olá,primeiroseapresentecomoseunome:','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':'Gostariadecadastrarmeuemail','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}]}"; + } + +} diff --git a/banco/app/src/main/java/br/banco/services/contact/data/remote/FromType.java b/banco/app/src/main/java/br/banco/services/contact/data/remote/FromType.java new file mode 100644 index 00000000..bba6012e --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/data/remote/FromType.java @@ -0,0 +1,27 @@ +package br.banco.services.contact.data.remote; + +import br.banco.services.contact.data.IContact; + + +public enum FromType { + + NATIONAL { + @Override + public IContact returnMessage() { + return new FromInternational(); + } + }, + INTERNATIONAL { + @Override + public IContact returnMessage() { + return new FromNational(); + } + } + + + ; + + public abstract IContact returnMessage(); + +} + diff --git a/banco/app/src/main/java/br/banco/services/contact/data/template/FromDatabase.java b/banco/app/src/main/java/br/banco/services/contact/data/template/FromDatabase.java new file mode 100644 index 00000000..dade38b2 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/data/template/FromDatabase.java @@ -0,0 +1,17 @@ +package br.banco.services.contact.data.template; + +import android.content.Context; +import android.support.v7.app.AppCompatActivity; + +import br.banco.services.contact.data.IContact; + +public class FromDatabase extends AppCompatActivity implements IContact { + + private Context b; + + public String configDesign(Context a) { + // this.b = a; + return "{'cells':[{'id':1,'type':2,'message':'Olá,primeiroseapresentecomoseunome:','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':'Gostariadecadastrarmeuemail','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}]}"; + } + +} diff --git a/banco/app/src/main/java/br/banco/services/contact/data/template/FromPreferences.java b/banco/app/src/main/java/br/banco/services/contact/data/template/FromPreferences.java new file mode 100644 index 00000000..f5e2fac8 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/data/template/FromPreferences.java @@ -0,0 +1,17 @@ +package br.banco.services.contact.data.template; + +import android.content.Context; +import android.support.v7.app.AppCompatActivity; + +import br.banco.services.contact.data.IContact; + +public class FromPreferences extends AppCompatActivity implements IContact { + + private Context b; + + public String configDesign(Context a) { + // this.b = a; + return "{'cells':[{'id':1,'type':2,'message':'Olá,primeiroseapresentecomoseunome:','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':'Gostariadecadastrarmeuemail','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}]}"; + } + +} diff --git a/banco/app/src/main/java/br/banco/services/contact/data/template/FromType.java b/banco/app/src/main/java/br/banco/services/contact/data/template/FromType.java new file mode 100644 index 00000000..999ab578 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/data/template/FromType.java @@ -0,0 +1,26 @@ +package br.banco.services.contact.data.template; + +import br.banco.services.contact.data.IContact; + + +public enum FromType { + + DATABASE { + @Override + public IContact returnMessage() { + return new FromPreferences(); + } + }, + PREERENCES { + @Override + public IContact returnMessage() { + return new FromDatabase(); + } + } + + ; + + public abstract IContact returnMessage(); + +} + diff --git a/banco/app/src/main/java/br/banco/services/contact/email/ByteArrayDataSource.java b/banco/app/src/main/java/br/banco/services/contact/email/ByteArrayDataSource.java new file mode 100644 index 00000000..5edf105c --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/email/ByteArrayDataSource.java @@ -0,0 +1,47 @@ +package br.banco.services.contact.email; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +import javax.activation.DataSource; + +public class ByteArrayDataSource implements DataSource { + private byte[] data; + private String type; + + public ByteArrayDataSource(byte[] data, String type) { + super(); + this.data = data; + this.type = type; + } + + public ByteArrayDataSource(byte[] data) { + super(); + this.data = data; + } + + public void setType(String type) { + this.type = type; + } + + public String getContentType() { + if (type == null) + return "application/octet-stream"; + else + return type; + } + + public InputStream getInputStream() throws IOException { + return new ByteArrayInputStream(data); + } + + public String getName() { + return "ByteArrayDataSource"; + } + + public OutputStream getOutputStream() throws IOException { + throw new IOException("Not Supported"); + } +} \ No newline at end of file diff --git a/banco/app/src/main/java/br/banco/services/contact/email/GMailSender.java b/banco/app/src/main/java/br/banco/services/contact/email/GMailSender.java new file mode 100644 index 00000000..525d982d --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/email/GMailSender.java @@ -0,0 +1,150 @@ +package br.banco.services.contact.email; + +import java.security.Security; +import java.util.Properties; + +import javax.activation.DataHandler; +import javax.mail.Message; +import javax.mail.PasswordAuthentication; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; + +public class GMailSender extends javax.mail.Authenticator { + + //private + + public String Mailhost = "smtp.gmail.com"; + public Session Session; + public String User ="busqe.irece@gmail.com"; + public String Password ="Zeus2030"; + + //public + + public String FullName; + public String Email; + public String Phone; // integer + public String EmailSave; // boolean + + public String EmailCopy; + public String Subject; + public String Body; + + public String getFullName() { + return FullName; + } + + public void setFullName(String fullName) { + FullName = fullName; + } + + public String getEmail() { + return Email; + } + + public void setEmail(String email) { + Email = email; + } + + public String getPhone() { + return Phone; + } + + public void setPhone(String phone) { + Phone = phone; + } + + public String getEmailSave() { + return EmailSave; + } + + public void setEmailSave(String emailSave) { + EmailSave = emailSave; + } + + public String getEmailCopy() { + return EmailCopy; + } + + public void setEmailCopy(String emailCopy) { + EmailCopy = emailCopy; + } + + public String getSubject() { + return Subject; + } + + public void setSubject(String subject) { + Subject = subject; + } + + public String getBody() { + return Body; + } + + public void setBody(String body) { + Body = body; + } + + + //config + + static { + Security.addProvider(new JSSEProvider()); + } + + public GMailSender() { + + this.User = User; + this.Password = Password; + + this.FullName = FullName; + this.Email = Email; + this.Phone = Phone; + this.EmailSave = EmailSave; + + this.EmailCopy = EmailCopy; + this.Subject = Subject; + this.Body = Body; + + Properties props = new Properties(); + props.setProperty("mail.transport.protocol", "smtp"); + props.setProperty("mail.host", Mailhost); + props.put("mail.smtp.auth", "true"); + props.put("mail.smtp.port", "465"); + props.put("mail.smtp.socketFactory.port", "465"); + props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); + props.put("mail.smtp.socketFactory.fallback", "false"); + + props.put("mail.smtp.starttls.enable","true"); + + props.setProperty("mail.smtp.quitwait", "false"); + + Session = Session.getDefaultInstance(props, this); + } + + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(User, Password); + } + + public synchronized void sendMail(String subject, String body, + String sender, String recipients) throws Exception { + MimeMessage message = new MimeMessage(Session); + + DataHandler handler = new DataHandler(new ByteArrayDataSource(body.getBytes(), + "text/plain")); + + message.setSender(new InternetAddress(sender)); + message.setSubject(subject); + message.setDataHandler(handler); + + if (recipients.indexOf(',') > 0) + message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipients)); + else + message.setRecipient(Message.RecipientType.TO, new InternetAddress(recipients)); + + Transport.send(message); + } + +} \ No newline at end of file diff --git a/banco/app/src/main/java/br/banco/services/contact/email/GMailSenderV3.java b/banco/app/src/main/java/br/banco/services/contact/email/GMailSenderV3.java new file mode 100644 index 00000000..67514fe0 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/email/GMailSenderV3.java @@ -0,0 +1,61 @@ +package br.banco.services.contact.email; + +import java.security.Security; +import java.util.Properties; + +import javax.activation.DataHandler; +import javax.mail.Message; +import javax.mail.PasswordAuthentication; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; + +import javax.mail.Address; + +import javax.mail.MessagingException; + +public class GMailSenderV3 +{ + public static void main(String[] args) { + Properties props = new Properties(); + + /** Parâmetros de conexão com servidor Gmail */ + props.put("mail.smtp.host", "smtp.gmail.com"); + props.put("mail.smtp.socketFactory.port", "465"); + props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); + props.put("mail.smtp.auth", "true"); + props.put("mail.smtp.port", "465"); + + Session session = Session.getDefaultInstance(props, + new javax.mail.Authenticator() { + protected PasswordAuthentication getPasswordAuthentication() + { + return new PasswordAuthentication("busqe.irece@gmail.com", "Zeus2030"); + } + }); + + /** Ativa Debug para sessão */ + session.setDebug(true); + + try { + + Message message = new MimeMessage(session); + message.setFrom(new InternetAddress("busqe.irece@gmail.com")); //Remetente + + Address[] toUser = InternetAddress //Destinatário(s) + .parse("adrianosouzai@gmail.com"); + + message.setRecipients(Message.RecipientType.TO, toUser); + message.setSubject("Enviando email com JavaMail");//Assunto + message.setText("Enviei este email utilizando JavaMail com minha conta GMail!"); + /**Método para enviar a mensagem criada*/ + Transport.send(message); + + System.out.println("Feito!!!"); + + } catch (MessagingException e) { + throw new RuntimeException(e); + } + } +} \ No newline at end of file diff --git a/banco/app/src/main/java/br/banco/services/contact/email/JSSEProvider.java b/banco/app/src/main/java/br/banco/services/contact/email/JSSEProvider.java new file mode 100644 index 00000000..eedf2cc9 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/email/JSSEProvider.java @@ -0,0 +1,21 @@ +package br.banco.services.contact.email; +import java.security.AccessController; +import java.security.Provider; + +public final class JSSEProvider extends Provider { + private static final long serialVersionUID = 1L; + + public JSSEProvider() { + super("HarmonyJSSE", 1.0, "Harmony JSSE Provider"); + AccessController.doPrivileged(new java.security.PrivilegedAction() { + @Override + public Void run() { + put("SSLContext.TLS","org.apache.harmony.xnet.provider.jsse.SSLContextImpl"); + put("Alg.Alias.SSLContext.TLSv1","TLS"); + put("KeyManagerFactory.X509","org.apache.harmony.xnet.provider.jsse.KeyManagerFactoryImpl"); + put("TrustManagerFactory.X509","org.apache.harmony.xnet.provider.jsse.TrustManagerFactoryImpl"); + return null; + } + }); + } +} \ No newline at end of file diff --git a/banco/app/src/main/java/br/banco/services/contact/message/ContactMsgPresenter.java b/banco/app/src/main/java/br/banco/services/contact/message/ContactMsgPresenter.java new file mode 100644 index 00000000..c1377ce9 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/message/ContactMsgPresenter.java @@ -0,0 +1,40 @@ +package br.banco.services.contact.message; + +import android.content.Context; + +import br.banco.services.app.alert.Alert; + + +public class ContactMsgPresenter { + + private Alert alert; + private View view; + + public ContactMsgPresenter(View view) { + this.alert = new Alert(); + this.view = view; + } + + public void loadAlertView(int msgCode, Context context){ + + msgCode = (msgCode >= 0 && msgCode < 5 ) ? msgCode : 0; + + ContactSenderType type = ContactSenderType.values()[msgCode]; + IContactMsg 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/banco/app/src/main/java/br/banco/services/contact/message/ContactMsgView.java b/banco/app/src/main/java/br/banco/services/contact/message/ContactMsgView.java new file mode 100644 index 00000000..d9b8d077 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/message/ContactMsgView.java @@ -0,0 +1,344 @@ + /* + + recebe + carrega + mostra = mensagem + @FAZER: onResume() checar conexao + abrir home + */ + +package br.banco.services.contact.message; + +import android.content.Intent; +import android.graphics.Color; +import android.graphics.PorterDuff; +import android.os.AsyncTask; +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 java.util.ArrayList; +import java.util.List; + +import javax.mail.MessagingException; + +import br.banco.services.R; +import br.banco.services.app.utils.ConnectionChek; + +import br.banco.services.contact.Contact; + + public class ContactMsgView extends AppCompatActivity implements ContactMsgPresenter.View { + + public String TAG = "CONTACT"; + public GMailSenderV2 emailSender ; + private ContactMsgPresenter presenter; + private Contact contactTest; + private ArrayList listSendMail ; + + + private int messageCode = 1; // Error // device + + private ConnectionChek internet; + private Handler handler; + + private Intent intentSender; + private Intent intentReceiver; + + 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); + + contactTest = new Contact(); + drawView(); + initProgressBar(); + presenter = new ContactMsgPresenter(this); + + listSendMail = new ArrayList(); + listSendMail.addAll(receiveIntentView()); + + // --------- + + internet = new ConnectionChek(); + + if(internet.isNetworkAvailable(getApplicationContext()) == true){ + // messageCode = 3; // Sucess + + if(listSendMail.size() > 0){ + + showProgressBar(); + + String teste ="OK"; + new sendEmailTask().execute(teste); + + // if( sendEmailView(listSendMail) ){ + messageCode = 0; + // } + + + }else{ + messageCode = 1; + presenter.loadAlertView(messageCode, getApplicationContext()); + } + + + }else{ + //messageCode = 4; // Error + } + + + + + + } + + @Override + public void onResume() { + super.onResume(); + + // presenter.loadAlertView(messageCode, getApplicationContext()); + + } + + + @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")); + } + + + } + + @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); + } + + + private ArrayList receiveIntentView(){ + + ArrayList listContact = new ArrayList(); + + if(getIntent().getExtras() != null){ + Bundle bundle = getIntent().getExtras(); + + if(bundle.getSerializable("contactData") != null){ + + try { + + listContact = (ArrayList) bundle.getSerializable("contactData"); + + //contactTest.showObjetc(TAG, getClass().getName() + " / onCreate", listContact); + //contactTest.showValues(TAG, getClass().getName() + " / onCreate", listContact); + + Log.d(TAG, " / ContactMsgView -> SUCCESS"); + + }catch (Exception e){ + Log.d(TAG, " / ContactMsgView -> ERROR = " + e.getMessage() ); + } + } + } + + return listContact; + } + + private Boolean sendEmailView(ArrayList listMail) { + + emailSender = new GMailSenderV2(); + boolean sendSuccess= false; + + String FullName; + String Email; + String Phone; + String EmailSave; + + String EmailCopy; + String Subject; + String Body; + + // FullName = listMail.get(0).getFullName() ; + //Email = listMail.get(0).getEmail(); + //// Phone = listMail.get(0).getPhone().toString(); + // EmailSave = "" + listMail.get(0).getEmailSave(); + + //Log.e(TAG, "listMail = " + listMail.get(0).getClass()); + + String subject = "assunto do email"; + String body = "corpo do email do " ; + + + try { + + emailSender.sendMail( + "NOVA MENSAGEM DO APP", + "NOVA MENSAGEM AQUI NO MEU APP", + "busqe.irece@gmail.com", + "adrianosouzai@gmail.com"); + + hideProgressBar(); + + Log.e(TAG, " / sendEmailView -> SUCCESS" ); + } catch (MessagingException e) { + Log.e(TAG, " / sendEmailView -> ERROR = " + e.getMessage()); + throw new RuntimeException(e); + } catch (Exception e) { + Log.e(TAG, " / sendEmailView - ERROR = " + e.fillInStackTrace()); + + } + + + + + + return sendSuccess; + } + + + + public class sendEmailTask extends AsyncTask { + + protected void onPreExecute() { + + Log.e(TAG,"sendEmailTask -> INICIO"); + showProgressBar(); + + } + + @Override + protected ResponseMail doInBackground(String... strings) { + + try { + + emailSender = new GMailSenderV2(); + + emailSender.sendMail( + "NOVA MSG LEGAL AQUI MEN", + "NOVA MENSAGEM AQUI NO MEU APP", + "busqe.irece@gmail.com", + "adrianosouzai@gmail.com"); + + + Log.e(TAG, " / sendEmailView -> SUCCESS"); + + } catch (MessagingException e) { + Log.e(TAG, " / sendEmailView -> ERROR = " + e.fillInStackTrace()); + throw new RuntimeException(e); + } catch (Exception e) { + Log.e(TAG, " / sendEmailView - ERROR = " + e.fillInStackTrace()); + + } + + Log.e(TAG,"sendEmailTask -> ENVIANDO"); + + return null; + } + + @Override + protected void onPostExecute(ResponseMail response) { + Log.e(TAG,"sendEmailTask -> FINAL"); + + hideProgressBar(); + } + + } + + + public class ResponseMail { + + private List lista = new ArrayList(); + + public List mLista() { + return lista; + } + + + } + + + + + // sistema + + 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 void showProgressBar() { + progressBar.setVisibility(View.VISIBLE); + } + + @Override + public void hideProgressBar() { + progressBar.setVisibility(View.INVISIBLE); + } + + @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_sair, R.anim.an_entrar); + return false; + } + return super.onKeyDown(keyCode, event); + } + + + } diff --git a/banco/app/src/main/java/br/banco/services/contact/message/ContactSenderError.java b/banco/app/src/main/java/br/banco/services/contact/message/ContactSenderError.java new file mode 100644 index 00000000..51074430 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/message/ContactSenderError.java @@ -0,0 +1,17 @@ +package br.banco.services.contact.message; + +import android.content.Context; +import android.support.v7.app.AppCompatActivity; + +import br.banco.services.R; + +public class ContactSenderError extends AppCompatActivity implements IContactMsg { + + private Context b; + + public String[] configDesign(Context a) { + this.b = a; + return b.getResources().getStringArray(R.array.alert_contact_error); + } + +} diff --git a/banco/app/src/main/java/br/banco/services/contact/message/ContactSenderSucess.java b/banco/app/src/main/java/br/banco/services/contact/message/ContactSenderSucess.java new file mode 100644 index 00000000..50fd67d7 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/message/ContactSenderSucess.java @@ -0,0 +1,18 @@ +package br.banco.services.contact.message; + +import android.content.Context; +import android.support.v7.app.AppCompatActivity; + +import br.banco.services.R; + +public class ContactSenderSucess extends AppCompatActivity implements IContactMsg { + + private Context b; + + public String[] configDesign(Context a) { + this.b = a; + return b.getResources().getStringArray(R.array.alert_contact_success); + } + +} + diff --git a/banco/app/src/main/java/br/banco/services/contact/message/ContactSenderType.java b/banco/app/src/main/java/br/banco/services/contact/message/ContactSenderType.java new file mode 100644 index 00000000..74202718 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/message/ContactSenderType.java @@ -0,0 +1,20 @@ +package br.banco.services.contact.message; + +public enum ContactSenderType { + + ERROR { + @Override + public IContactMsg returnMessage() { + return new ContactSenderError(); + } + }, + SUCESS { + @Override + public IContactMsg returnMessage() { + return new ContactSenderSucess(); + } + }; + + public abstract IContactMsg returnMessage(); + +} diff --git a/banco/app/src/main/java/br/banco/services/contact/message/GMailSenderV2.java b/banco/app/src/main/java/br/banco/services/contact/message/GMailSenderV2.java new file mode 100644 index 00000000..04b2e276 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/message/GMailSenderV2.java @@ -0,0 +1,203 @@ +package br.banco.services.contact.message; + +import android.util.Log; + +import java.security.Security; +import java.util.Properties; + +import javax.activation.DataHandler; +import javax.mail.Message; +import javax.mail.PasswordAuthentication; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; + +import br.banco.services.contact.email.ByteArrayDataSource; +import br.banco.services.contact.email.JSSEProvider; + + +public class GMailSenderV2 extends javax.mail.Authenticator{ + + + public String Mailhost = "smtp.gmail.com"; + public String User ="busqe.irece@gmail.com"; + public String Password ="Zeus2030"; + + public javax.mail.Session Session; + + //public + + public String FullName; + public String Email; + public String Phone; // Long + public String EmailSave; // integer + + public String EmailCopy; + public String Subject; + public String Body; + + + + public String getMailhost() { + return Mailhost; + } + + public void setMailhost(String mailhost) { + Mailhost = mailhost; + } + + public javax.mail.Session getSession() { + return Session; + } + + public void setSession(javax.mail.Session session) { + Session = session; + } + + public String getUser() { + return User; + } + + public void setUser(String user) { + User = user; + } + + public String getPassword() { + return Password; + } + + public void setPassword(String password) { + Password = password; + } + + public String getFullName() { + return FullName; + } + + public void setFullName(String fullName) { + FullName = fullName; + } + + public String getEmail() { + return Email; + } + + public void setEmail(String email) { + Email = email; + } + + public String getPhone() { + return Phone; + } + + public void setPhone(String phone) { + Phone = phone; + } + + public String getEmailSave() { + return EmailSave; + } + + public void setEmailSave(String emailSave) { + EmailSave = emailSave; + } + + public String getEmailCopy() { + return EmailCopy; + } + + public void setEmailCopy(String emailCopy) { + EmailCopy = emailCopy; + } + + public String getSubject() { + return Subject; + } + + public void setSubject(String subject) { + Subject = subject; + } + + public String getBody() { + return Body; + } + + public void setBody(String body) { + Body = body; + } + + + //config + + static { + Security.addProvider(new JSSEProvider()); + } + + public GMailSenderV2() { + + this.User = User; + this.Password = Password; + + this.FullName = FullName; + this.Email = Email; + this.Phone = Phone; + this.EmailSave = EmailSave; + + this.EmailCopy = EmailCopy; + this.Subject = Subject; + this.Body = Body; + + + Properties props = new Properties(); + + props.setProperty("mail.transport.protocol", "smtp"); + props.setProperty("mail.host", Mailhost); + props.put("mail.smtp.auth", "true"); + props.put("mail.smtp.port", "465"); + props.put("mail.smtp.socketFactory.port", "465"); + props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); + props.put("mail.smtp.socketFactory.fallback", "false"); + + props.put("mail.smtp.starttls.enable","true"); + + props.setProperty("mail.smtp.quitwait", "false"); + + Session = Session.getDefaultInstance(props, this); + } + + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(User, Password); + } + + public synchronized void sendMail( + String subject, + String body, + String sender, + String recipients) + + throws Exception { + + MimeMessage message = new MimeMessage(Session); + DataHandler handler = new DataHandler(new ByteArrayDataSource(body.getBytes(), + "text/plain")); + + message.setSender(new InternetAddress(sender)); + message.setSubject(subject); + message.setDataHandler(handler); + + if (recipients.indexOf(',') > 0) + message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipients)); + else + message.setRecipient(Message.RecipientType.TO, new InternetAddress(recipients)); + + Transport.send(message); + + Log.e("CONTACT", "VIEW / GMailSenderV2 -> SUCCESS"); + } + + + + + +} diff --git a/banco/app/src/main/java/br/banco/services/contact/message/IContactMsg.java b/banco/app/src/main/java/br/banco/services/contact/message/IContactMsg.java new file mode 100644 index 00000000..362450c4 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/message/IContactMsg.java @@ -0,0 +1,10 @@ +package br.banco.services.contact.message; + +import android.content.Context; + +public interface IContactMsg { + + public String[] configDesign(Context context); + +} + diff --git a/banco/app/src/main/java/br/banco/services/contact/message/JSSEProvider.java b/banco/app/src/main/java/br/banco/services/contact/message/JSSEProvider.java new file mode 100644 index 00000000..3d1752e3 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/contact/message/JSSEProvider.java @@ -0,0 +1,21 @@ +package br.banco.services.contact.message; +import java.security.AccessController; +import java.security.Provider; + +public final class JSSEProvider extends Provider { + private static final long serialVersionUID = 1L; + + public JSSEProvider() { + super("HarmonyJSSE", 1.0, "Harmony JSSE Provider"); + AccessController.doPrivileged(new java.security.PrivilegedAction() { + @Override + public Void run() { + put("SSLContext.TLS","org.apache.harmony.xnet.provider.jsse.SSLContextImpl"); + put("Alg.Alias.SSLContext.TLSv1","TLS"); + put("KeyManagerFactory.X509","org.apache.harmony.xnet.provider.jsse.KeyManagerFactoryImpl"); + put("TrustManagerFactory.X509","org.apache.harmony.xnet.provider.jsse.TrustManagerFactoryImpl"); + return null; + } + }); + } +} \ No newline at end of file diff --git a/banco/app/src/main/java/br/banco/services/fund/BasePresenter.java b/banco/app/src/main/java/br/banco/services/fund/BasePresenter.java new file mode 100644 index 00000000..4638e205 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/BasePresenter.java @@ -0,0 +1,6 @@ +package br.banco.services.fund; + +public interface BasePresenter { + + void start(); +} diff --git a/banco/app/src/main/java/br/banco/services/fund/BaseView.java b/banco/app/src/main/java/br/banco/services/fund/BaseView.java new file mode 100644 index 00000000..dc1aa14c --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/BaseView.java @@ -0,0 +1,6 @@ +package br.banco.services.fund; + +public interface BaseView { + + void start(); +} diff --git a/banco/app/src/main/java/br/banco/services/fund/FundModelTemplate.java b/banco/app/src/main/java/br/banco/services/fund/FundModelTemplate.java new file mode 100644 index 00000000..8e5633ad --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/FundModelTemplate.java @@ -0,0 +1,563 @@ +package br.banco.services.fund; + +import android.util.Log; +import java.util.ArrayList; + +public class FundModelTemplate { + + ArrayList listArrayOptions = new ArrayList(); + + // LABELS + + private String NameLabel; + private String MonthLabel; + private String TimeLabel; + + // VALORES + + private String Name; + private String Month; + private String Time; + + + public FundModelTemplate(){ + + //showListOptionsTemplate(); + + } + + + // valores + + public String getName() { + return Name; + } + + public void setName(int name) { + Name = listMoreInfoTemplate[name][0][1] ; + } + + public String getMonth() { + return Month; + } + + public void setMonth(int month) { + Month = listMoreInfoTemplate[month][1][1]; + } + + public String getTime() { + return Time; + } + + public void setTime(int time) { + Time = listMoreInfoTemplate[time][2][1]; + } + + + // labels + + + public String getNameLabel() { + return NameLabel; + } + + public void setNameLabel(int nameLabel) { + NameLabel = listMoreInfoTemplate[nameLabel][0][0] ; + } + + public String getMonthLabel() { + return MonthLabel; + } + + public void setMonthLabel(int monthLabel) { + MonthLabel = listMoreInfoTemplate[monthLabel][1][0]; + } + + public String getTimeLabel() { + return TimeLabel; + } + + public void setTimeLabel(int timeLabel) { + TimeLabel = listMoreInfoTemplate[timeLabel][2][0]; + } + + + // lista todos os fundos + + + public void showListOptionsTemplate(){ + + + for(int count = 0; count < listMoreInfoTemplate.length; count ++){ + + Log.d("FUND","FUNDOS / showListOptionsTemplate => ["+count+"] " ); + + Log.d("FUND","NOME = " + listMoreInfoTemplate[count][0][0] + " : " +listMoreInfoTemplate[count][0][1] ); + Log.d("FUND","MES = " + listMoreInfoTemplate[count][1][0] + " : " +listMoreInfoTemplate[count][1][1] ); + Log.d("FUND","12MESES = " + listMoreInfoTemplate[count][2][0] + " : " +listMoreInfoTemplate[count][2][1] ); + Log.d("FUND"," ----------------------------------------- "); + + // Log.d("FUND","START = "+count+" = " + listOptions[count][0][1]); + + + } + + } + + // detalha um fumdo + + public void showListOptionsObjectTemplate(FundModelTemplate fd){ + + + for(int count = 0; count < listMoreInfoTemplate.length; count ++){ + + Log.d("FUND","FUNDOS / showListOptionsObjectTemplate => ["+count+"] " ); + + Log.d("FUND","NOME = " + fd.getNameLabel() + " : " +fd.getName() ); + Log.d("FUND","MES = " + fd.getMonthLabel() + " : " +fd.getMonth() ); + Log.d("FUND","12MESES = " + fd.getTimeLabel() + " : " +fd.getTime() ); + Log.d("FUND"," ----------------------------------------- "); + + // Log.d("FUND","START = "+count+" = " + listOptions[count][0][1]); + + + } + + } + + + public void putListOptionsObjectTemplate(int count){ + + setNameLabel(count); + setMonthLabel(count); + setTimeLabel(count); + + setName(count); + setMonth(count); + setTime(count); + + Log.d("FUND","FUNDOS / putListOptionsObjectTemplate() => ["+count+"] " ); + + Log.d("FUND","NOME = " + getNameLabel() + " : " + getName() ); + Log.d("FUND","MES = " + getMonthLabel() + " : " + getMonth() ); + Log.d("FUND","12MESES = " + getTimeLabel() + " : " + getTime() ); + Log.d("FUND"," ----------------------------------------- "); + + + } + + + + // template 01 -- LIST + + //static final String listMoreInfoTemplate[][][] = + public static String listMoreInfoTemplate[][][] = + { //0 + + { //0 + { "title", "Zeus ZERO Plus Multimercado" }, + { "month","0.1" }, + { "12months","0.9" } + }, + { //1 + { "title", "Cronus UM Dinâmico Plus Multimercado Internacional " }, + { "month","1.1" }, + { "12months","1.9" } + }, + { //2 + { "title", "Hades DOIS Dinâmico Plus Multimercado" }, + { "month","3.1" }, + { "12months","2.9" } + }, + { //3 + { "title", "Herculos TRES Dinâmico Plus Debentures Incentivadas Renda Fixa " }, + { "month","3.1" }, + { "12months","3.9" } + }, + { //4 + { "title", "Zeus QUATRO Plus Multimercado" }, + { "month","4.1" }, + { "12months","4.9" } + }, + { //5 + { "title", "Cronus CINCO Dinâmico Plus " }, + { "month","5.1" }, + { "12months","5.9" } + }, + { //6 + { "title", "Hades SEIS Dinâmico Plus Multimercado" }, + { "month","6.1" }, + { "12months","6.9" } + }, + { //7 + { "title", "Herculos SETE Dinâmico Plus " }, + { "month","7.1" }, + { "12months","7.9" } + }, + { //8 + { "title", "Zeus OITO Dinâmico Plus Multimercado" }, + { "month","8.1" }, + { "12months","8.9" } + }, + { //9 + { "title", "Cronus NOVE Fundo Dinâmico Plus Multimercado" }, + { "month","9.1" }, + { "12months","9.9" } + }, + { //10 + { "title", "Hades DEZ Fundo Dinâmico Plus " }, + { "month","10.1" }, + { "12months","10.9" } + }, + { //11 + { "title", "Herculos ONZE Fundo Dinâmico Plus " }, + { "month","11.1" }, + { "12months","11.9" } + }, + { //12 + { "title", "Zeus DOZE Dinâmico Plus Multimercado" }, + { "month","12.1" }, + { "12months","12.9" } + }, + { //13 + { "title", "Cronus TREZE Fundo Dinâmico Plus " }, + { "month","13.1" }, + { "12months","13.9" } + }, + { //14 + { "title", "Hades QUATORZE Fundo Dinâmico Plus Multimercado" }, + { "month","14.1" }, + { "12months","14.9" } + }, + { //15 + { "title", "Herculos QUINZE Fundo Dinâmico Plus " }, + { "month","15.1" }, + { "12months","15.9" } + } + + + }; + + public String[][][][] createListInfoTemplate(){ + + String[][][][] listInfoTemplate2 ={}; + + for(int count = 0; count < listMoreInfoTemplate.length; count ++) { + + String[][][][] listInfoTemplate = + { + { //0 -> nome + + { //0 + {"title", "" + count}, + {"name", "Taxa de administração"}, + {"data", "0,50%"}, + + }, + { //1 + {"title", ""+ count}, + {"name", "Aplicação inicial"}, + {"data", "R$ 10.000,00"} + }, + { //2 + {"title", ""+ count}, + {"name", "Movimentação mínima"}, + {"data", "R$ 1.000,00"} + }, + { //3 + {"title", ""+ count}, + {"name", "Saldo mínimo"}, + {"data", "R$ 5.000,00"} + }, + { //4 + {"title", ""+ count}, + {"name", "Resgate (valor bruto)"}, + {"data", "D+0"} + }, + { //5 + {"title", ""+ count}, + {"name", "Cota (valor bruto)"}, + {"data", "D+1"} + }, + { //6 + {"title", ""+ count}, + {"name", "Pagamento (valor bruto)"}, + {"data", "D+2"} + } + + } + + + }; + } //for + + return listInfoTemplate2; + } + + // template 02 + + + + + static final String listMoreInfoDetailsTemplate[][][][] = + { + { //01 + { //month + { "fund", "0.3" }, + { "CDI","0.3" } + }, + { //year + { "fund", "13.01" }, + { "CDI","12.08" } + } + , + { //12months + { "fund", "17.9" }, + { "CDI","17.6" } + } + }, + { //02 + { //month + { "fund", "0.3" }, + { "CDI","0.3" } + }, + { //year + { "fund", "13.01" }, + { "CDI","12.08" } + } + , + { //12months + { "fund", "17.9" }, + { "CDI","17.6" } + } + }, + { // 03 + { //month + { "fund", "0.3" }, + { "CDI","0.3" } + }, + { //year + { "fund", "13.01" }, + { "CDI","12.08" } + } + , + { //12months + { "fund", "17.9" }, + { "CDI","17.6" } + } + }, + { // 04 + { //month + { "fund", "0.3" }, + { "CDI","0.3" } + }, + { //year + { "fund", "13.01" }, + { "CDI","12.08" } + } + , + { //12months + { "fund", "17.9" }, + { "CDI","17.6" } + } + + }, + { //05 + { //month + { "fund", "0.3" }, + { "CDI","0.3" } + }, + { //year + { "fund", "13.01" }, + { "CDI","12.08" } + } + , + { //12months + { "fund", "17.9" }, + { "CDI","17.6" } + } + }, + { //06 + { //month + { "fund", "0.3" }, + { "CDI","0.3" } + }, + { //year + { "fund", "13.01" }, + { "CDI","12.08" } + } + , + { //12months + { "fund", "17.9" }, + { "CDI","17.6" } + } + }, + { // 07 + { //month + { "fund", "0.3" }, + { "CDI","0.3" } + }, + { //year + { "fund", "13.01" }, + { "CDI","12.08" } + } + , + { //12months + { "fund", "17.9" }, + { "CDI","17.6" } + } + }, + { // 08 + { //month + { "fund", "0.3" }, + { "CDI","0.3" } + }, + { //year + { "fund", "13.01" }, + { "CDI","12.08" } + } + , + { //12months + { "fund", "17.9" }, + { "CDI","17.6" } + } + + }, + { //09 + { //month + { "fund", "0.3" }, + { "CDI","0.3" } + }, + { //year + { "fund", "13.01" }, + { "CDI","12.08" } + } + , + { //12months + { "fund", "17.9" }, + { "CDI","17.6" } + } + }, + { //10 + { //month + { "fund", "0.3" }, + { "CDI","0.3" } + }, + { //year + { "fund", "13.01" }, + { "CDI","12.08" } + } + , + { //12months + { "fund", "17.9" }, + { "CDI","17.6" } + } + }, + { // 11 + { //month + { "fund", "0.3" }, + { "CDI","0.3" } + }, + { //year + { "fund", "13.01" }, + { "CDI","12.08" } + } + , + { //12months + { "fund", "17.9" }, + { "CDI","17.6" } + } + }, + { // 12 + { //month + { "fund", "0.3" }, + { "CDI","0.3" } + }, + { //year + { "fund", "13.01" }, + { "CDI","12.08" } + } + , + { //12months + { "fund", "17.9" }, + { "CDI","17.6" } + } + + }, + { //13 + { //month + { "fund", "0.3" }, + { "CDI","0.3" } + }, + { //year + { "fund", "13.01" }, + { "CDI","12.08" } + } + , + { //12months + { "fund", "17.9" }, + { "CDI","17.6" } + } + }, + { //14 + { //month + { "fund", "0.3" }, + { "CDI","0.3" } + }, + { //year + { "fund", "13.01" }, + { "CDI","12.08" } + } + , + { //12months + { "fund", "17.9" }, + { "CDI","17.6" } + } + }, + { // 15 + { //month + { "fund", "0.3" }, + { "CDI","0.3" } + }, + { //year + { "fund", "13.01" }, + { "CDI","12.08" } + } + , + { //12months + { "fund", "17.9" }, + { "CDI","17.6" } + } + }, + { // 16 + { //month + { "fund", "0.3" }, + { "CDI","0.3" } + }, + { //year + { "fund", "13.01" }, + { "CDI","12.08" } + } + , + { //12months + { "fund", "17.9" }, + { "CDI","17.6" } + } + + } + }; + + + public static String[][][] getListMoreInfoTemplate() { + return listMoreInfoTemplate; + } + + public static String[][][][] getListMoreInfoDetailsTemplate() { + return listMoreInfoDetailsTemplate; + } + + + public final String SAVE_DATA_CONTACT ="{'cells':[{'id':1,'type':2,'message':'Olá,primeiroseapresentecomoseunome:','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':'Gostariadecadastrarmeuemail','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}]}"; + + public final String SAVE_DATA_FUND_ = "{'screen':{'title':'Fundosdeinvestimento','fundName':'VinciValoremFIMultimercado','whatIs':'Oqueé?','definition':'OFundotemporobjetivoproporcionaraosseuscotistasrentabilidadenolongoprazoatravésdeinvestimentos.','riskTitle':'Grauderiscodoinvestimento','risk':4,'infoTitle':'Maisinformaçõessobreoinvestimento','moreInfo':{'month':{'fund':0.3,'CDI':0.3},'year':{'fund':13.01,'CDI':12.08},'12months':{'fund':17.9,'CDI':17.6}},'info':[{'name':'Taxadeadministração','data':'0,50%'},{'name':'Aplicaçãoinicial','data':'R$10.000,00'},{'name':'Movimentaçãomínima','data':'R$1.000,00'},{'name':'Saldomínimo','data':'R$5.000,00'},{'name':'Resgate(valorbruto)','data':'D+0'},{'name':'Cota(valorbruto)','data':'D+1'},{'name':'Pagamento(valorbruto)','data':'D+2'}],'downInfo':[{'name':'Essenciais','data':null},{'name':'Desempenho','data':null},{'name':'Complementares','data':null},{'name':'Regulamento','data':null},{'name':'Adesão','data':null}]}}"; +} \ No newline at end of file diff --git a/banco/app/src/main/java/br/banco/services/fund/data/FundRepository.java b/banco/app/src/main/java/br/banco/services/fund/data/FundRepository.java new file mode 100644 index 00000000..9470b293 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/FundRepository.java @@ -0,0 +1,24 @@ +package br.banco.services.fund.data; + +import android.content.Context; + +public class FundRepository implements IFundData{ + + private Context b; + public String configDesign(Context a){ + + this.b = a; + return ""; + + } + + public void getFund(){ + + } + + public void checkFund(){ + + + } + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/data/IFundData.java b/banco/app/src/main/java/br/banco/services/fund/data/IFundData.java new file mode 100644 index 00000000..b1efd5f4 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/IFundData.java @@ -0,0 +1,13 @@ +package br.banco.services.fund.data; + +import android.content.Context; + +public interface IFundData { + + String configDesign(Context context); + + // void getFund(); + //void checkFund(); + +} + diff --git a/banco/app/src/main/java/br/banco/services/fund/data/local/FromDatabase.java b/banco/app/src/main/java/br/banco/services/fund/data/local/FromDatabase.java new file mode 100644 index 00000000..a6fa1775 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/local/FromDatabase.java @@ -0,0 +1,28 @@ +package br.banco.services.fund.data.local; + +import android.content.Context; +import android.support.v7.app.AppCompatActivity; + +import br.banco.services.R; +import br.banco.services.fund.data.IFundData; + +public class FromDatabase extends AppCompatActivity implements IFundData { + + private Context b; + public String configDesign(Context a){ + + this.b = a; + return ""; + + } + + public void getFund(){ + + } + + public void checkFund(){ + + + } + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/data/local/FromPreferences.java b/banco/app/src/main/java/br/banco/services/fund/data/local/FromPreferences.java new file mode 100644 index 00000000..aa500147 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/local/FromPreferences.java @@ -0,0 +1,28 @@ +package br.banco.services.fund.data.local; + +import android.content.Context; +import android.support.v7.app.AppCompatActivity; + +import br.banco.services.R; +import br.banco.services.fund.data.IFundData; + +public class FromPreferences extends AppCompatActivity implements IFundData { + + private Context b; + public String configDesign(Context a){ + + this.b = a; + return ""; + + } + + public void getFund(){ + + } + + public void checkFund(){ + + + } + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/data/local/FromType.java b/banco/app/src/main/java/br/banco/services/fund/data/local/FromType.java new file mode 100644 index 00000000..930f5cfc --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/local/FromType.java @@ -0,0 +1,25 @@ +package br.banco.services.fund.data.local; + +import br.banco.services.fund.data.IFundData; + + +public enum FromType { + + DATABASE { + @Override + public IFundData returnMessage() { + return new FromPreferences(); + } + }, + PREERENCES { + @Override + public IFundData returnMessage() { + return new FromDatabase(); + } + } + + ; + + public abstract IFundData returnMessage(); + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/data/local/ILoadFrom.java b/banco/app/src/main/java/br/banco/services/fund/data/local/ILoadFrom.java new file mode 100644 index 00000000..dc0ca63f --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/local/ILoadFrom.java @@ -0,0 +1,12 @@ +package br.banco.services.fund.data.local; + +import java.util.List; + + +public interface ILoadFrom { + + void processFinish(String output); // load + void convertFinish(List listScreen, String message); // object + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/data/local/LoadFileLocal.java b/banco/app/src/main/java/br/banco/services/fund/data/local/LoadFileLocal.java new file mode 100644 index 00000000..135042ea --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/local/LoadFileLocal.java @@ -0,0 +1,40 @@ +package br.banco.services.fund.data.local; + +import android.util.Log; + +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +public class LoadFileLocal { + + + public String loadExternalJson(String jsonURL) throws IOException { + + StringBuilder SB = new StringBuilder(); + + String fileName = "NOME_ARQUIVO_LOCAL.txt"; + + try { + + + } catch(Exception ex) { + Log.e("FUND", "O arquivo nao pode ser lido '" + fileName + "'"); + } + + return SB.toString(); + + } //loadExternalJson + + + +} + + + + diff --git a/banco/app/src/main/java/br/banco/services/fund/data/local/LoadFileLocalReal.java b/banco/app/src/main/java/br/banco/services/fund/data/local/LoadFileLocalReal.java new file mode 100644 index 00000000..fbb002c5 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/local/LoadFileLocalReal.java @@ -0,0 +1,61 @@ +package br.banco.services.fund.data.local; + +import android.util.Log; + +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; + +public class LoadFileLocalReal { + + + public String loadExternalJson(String jsonURL) throws IOException { + + // Log.d("FUND","MODEL / "+getClass().getName()+" -> " + jsonURL); + + //FileOutputStream fOut = openFileOutput(file,MODE_WORLD_READABLE); + + + StringBuilder SB = new StringBuilder(); + String fileName = "/sdcard/PROD_COD.txt"; + + String line = null; + + try { + + FileReader fileReader = new FileReader(fileName); + + BufferedReader bufferedReader = + new BufferedReader(fileReader); + + while((line = bufferedReader.readLine()) != null) { + System.out.println(line); + SB.append(line); + } + + bufferedReader.close(); + } + catch(FileNotFoundException ex) { + Log.e("FUND", "Arquivo nao pode ser aberto: '" + fileName + "'"); + } + catch(IOException ex) { + Log.e("FUND", "O arquivo nao pode ser lido '" + fileName + "'"); + // Or we could just do this: + // ex.printStackTrace(); + } + + + return SB.toString(); + + } //loadExternalJson + + + + + +} + + + + diff --git a/banco/app/src/main/java/br/banco/services/fund/data/local/LoadFileLocalTask.java b/banco/app/src/main/java/br/banco/services/fund/data/local/LoadFileLocalTask.java new file mode 100644 index 00000000..4b3c905e --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/local/LoadFileLocalTask.java @@ -0,0 +1,73 @@ + +package br.banco.services.fund.data.local; + +import android.content.Context; +import android.os.AsyncTask; +import android.util.Log; + +public class LoadFileLocalTask extends AsyncTask { + + public ILoadFrom delegate = null; + + public LoadFileLocalTask(Context context) { + + // + } + + @Override + protected void onPreExecute() { + super.onPreExecute(); + + // Log.d("FUND","MODEL / "+getClass().getName()+" / doInBackground -> START "); + } + + @Override + protected String doInBackground(String... loadValues) { + + // Log.d("FUND","doInBackground -> " + loadValues[0] ); + + String teste = "0"; + String textValues = null; + String urlServer = loadValues[0]; // ValidatorURL + + // web, local + + + try { + + LoadFileLocal load = new LoadFileLocal(); + textValues = load.loadExternalJson(urlServer); + + Log.d("FUND","MODEL /"+getClass().getName()+" -> SUCCESS" ); + + + } catch (Exception e) { + Log.d("FUND","MODEL /"+getClass().getName()+" doInBackground -> ERROR: " + e.getMessage()); + e.printStackTrace(); + } + + return textValues; + + } + + protected void onProgressUpdate(String... progress) { + //Log.d("FUND", "MODEL / doInBackground -> " + progress[0]); + } + + @Override + protected void onPostExecute(String result) { + + // Log.d("FUND", "MODEL / onPostExecute -> result=" + result); + delegate.processFinish(result); + + } + + + + + + + + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/data/remote/FromInternational.java b/banco/app/src/main/java/br/banco/services/fund/data/remote/FromInternational.java new file mode 100644 index 00000000..eb64f253 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/remote/FromInternational.java @@ -0,0 +1,26 @@ +package br.banco.services.fund.data.remote; + +import android.content.Context; +import android.support.v7.app.AppCompatActivity; + +import br.banco.services.fund.data.IFundData; + +public class FromInternational extends AppCompatActivity implements IFundData { + + private Context b; + public String configDesign(Context a){ + + this.b = a; + return ""; + + } + + public void getFund(){ + + } + + public void checkFund(){ + + + } +} diff --git a/banco/app/src/main/java/br/banco/services/fund/data/remote/FromNational.java b/banco/app/src/main/java/br/banco/services/fund/data/remote/FromNational.java new file mode 100644 index 00000000..5b39e282 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/remote/FromNational.java @@ -0,0 +1,29 @@ +package br.banco.services.fund.data.remote; + +import android.content.Context; +import android.support.v7.app.AppCompatActivity; + +import br.banco.services.fund.data.IFundData; + +public class FromNational extends AppCompatActivity implements IFundData { + + + private Context b; + public String configDesign(Context a){ + + this.b = a; + return ""; + + } + + public void getFund(){ + + } + + public void checkFund(){ + + + } + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/data/remote/FromType.java b/banco/app/src/main/java/br/banco/services/fund/data/remote/FromType.java new file mode 100644 index 00000000..33fb65a2 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/remote/FromType.java @@ -0,0 +1,25 @@ +package br.banco.services.fund.data.remote; + +import br.banco.services.fund.data.IFundData; + + +public enum FromType { + + NATIONAL { + @Override + public IFundData returnMessage() { + return new FromNational(); + } + }, + INTERNATIONAL { + @Override + public IFundData returnMessage() { + return new FromInternational(); + } + } + + ; + + public abstract IFundData returnMessage(); + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/data/remote/ILoadFrom.java b/banco/app/src/main/java/br/banco/services/fund/data/remote/ILoadFrom.java new file mode 100644 index 00000000..5683dc8e --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/remote/ILoadFrom.java @@ -0,0 +1,12 @@ +package br.banco.services.fund.data.remote; + +import java.util.List; + + +public interface ILoadFrom { + + void processFinish(String output); // load + void convertFinish(List listScreen, String message); // object + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/data/remote/LoadFileHttp.java b/banco/app/src/main/java/br/banco/services/fund/data/remote/LoadFileHttp.java new file mode 100644 index 00000000..2de2745c --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/remote/LoadFileHttp.java @@ -0,0 +1,61 @@ +package br.banco.services.fund.data.remote; + +import android.util.Log; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +public class LoadFileHttp { + + + public String loadExternalJson(String jsonURL) throws IOException { + + // Log.d("FUND","MODEL / "+getClass().getName()+" -> " + jsonURL); + + try{ + + URL url = new URL(jsonURL); + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + + conn.setReadTimeout(10000); + conn.setConnectTimeout(15000); + conn.setRequestMethod("GET"); + conn.setDoInput(true); + conn.connect(); + + BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); + String line; + StringBuilder SB = new StringBuilder(); + + while ((line = in.readLine()) != null) { + + // Log.d("FUND", "@@ loadJSON() " + line); + + SB.append(line); + + } + + //Log.d("FUND","MODEL / loadExternalJson -> SUCCESS" ); + + in.close(); + return SB.toString(); + + }catch (Exception ex){ + Log.d("FUND","MODEL / loadExternalJson -> ERROR" +ex.getMessage() ); + return null; + } + + + + } //loadExternalJson + + + +} + + + + diff --git a/banco/app/src/main/java/br/banco/services/fund/data/remote/LoadFileHttpTask.java b/banco/app/src/main/java/br/banco/services/fund/data/remote/LoadFileHttpTask.java new file mode 100644 index 00000000..6231be9a --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/remote/LoadFileHttpTask.java @@ -0,0 +1,73 @@ + +package br.banco.services.fund.data.remote; + +import android.content.Context; +import android.os.AsyncTask; +import android.util.Log; + +public class LoadFileHttpTask extends AsyncTask { + + public ILoadFrom delegate = null; + + public LoadFileHttpTask(Context context) { + + // + } + + @Override + protected void onPreExecute() { + super.onPreExecute(); + + // Log.d("FUND","MODEL / "+getClass().getName()+" / doInBackground -> START "); + } + + @Override + protected String doInBackground(String... loadValues) { + + // Log.d("FUND","doInBackground -> " + loadValues[0] ); + + String teste = "0"; + String textValues = null; + String urlServer = loadValues[0]; // ValidatorURL + + // web, local + + try { + + + LoadFileHttp load = new LoadFileHttp(); + textValues = load.loadExternalJson(urlServer); + + Log.d("FUND","MODEL /"+getClass().getName()+" -> SUCCESS" ); + + + } catch (Exception e) { + Log.d("FUND","MODEL /"+getClass().getName()+" doInBackground -> ERROR: " + e.getMessage()); + e.printStackTrace(); + } + + return textValues; + + } + + protected void onProgressUpdate(String... progress) { + //Log.d("FUND", "MODEL / doInBackground -> " + progress[0]); + } + + @Override + protected void onPostExecute(String result) { + + // Log.d("FUND", "MODEL / onPostExecute -> result=" + result); + delegate.processFinish(result); + + } + + + + + + + + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/data/template/FomMoreinfo.java b/banco/app/src/main/java/br/banco/services/fund/data/template/FomMoreinfo.java new file mode 100644 index 00000000..6000d620 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/template/FomMoreinfo.java @@ -0,0 +1,29 @@ +package br.banco.services.fund.data.template; + +import android.content.Context; +import android.support.v7.app.AppCompatActivity; + +import br.banco.services.R; +import br.banco.services.fund.data.IFundData; + +public class FomMoreinfo extends AppCompatActivity implements IFundData { + + + private Context b; + public String configDesign(Context a){ + + this.b = a; + return ""; + + } + + public void getFund(){ + + } + + public void checkFund(){ + + + } + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/data/template/FromDownInfo.java b/banco/app/src/main/java/br/banco/services/fund/data/template/FromDownInfo.java new file mode 100644 index 00000000..8ed3ee8d --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/template/FromDownInfo.java @@ -0,0 +1,29 @@ +package br.banco.services.fund.data.template; + +import android.content.Context; +import android.support.v7.app.AppCompatActivity; + +import br.banco.services.R; +import br.banco.services.fund.data.IFundData; + +public class FromDownInfo extends AppCompatActivity implements IFundData { + + private Context b; + + public String configDesign(Context a) { + this.b = a; + return ""; + } + + + public void getFund(){ + + } + + public void checkFund(){ + + + } + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/data/template/FromFund.java b/banco/app/src/main/java/br/banco/services/fund/data/template/FromFund.java new file mode 100644 index 00000000..0dbaefdb --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/template/FromFund.java @@ -0,0 +1,36 @@ +package br.banco.services.fund.data.template; + +import android.content.Context; +import android.support.v7.app.AppCompatActivity; + +import br.banco.services.fund.data.IFundData; + +public class FromFund extends AppCompatActivity implements IFundData { + + + private Context b; + + public String configDesign(Context a) { + this.b = a; + return LOAD_DATA_DEVICE; + } + + public final String LOAD_DATA_DEVICE = "{'screen':{'title':'Fundosdeinvestimento','fundName':'VinciValoremFIMultimercado','whatIs':'Oqueé?','definition':'OFundotemporobjetivoproporcionaraosseuscotistasrentabilidadenolongoprazoatravésdeinvestimentos.','riskTitle':'Grauderiscodoinvestimento','risk':4,'infoTitle':'Maisinformaçõessobreoinvestimento','moreInfo':{'month':{'fund':0.3,'CDI':0.3},'year':{'fund':13.01,'CDI':12.08},'12months':{'fund':17.9,'CDI':17.6}},'info':[{'name':'Taxadeadministração','data':'0,50%'},{'name':'Aplicaçãoinicial','data':'R$10.000,00'},{'name':'Movimentaçãomínima','data':'R$1.000,00'},{'name':'Saldomínimo','data':'R$5.000,00'},{'name':'Resgate(valorbruto)','data':'D+0'},{'name':'Cota(valorbruto)','data':'D+1'},{'name':'Pagamento(valorbruto)','data':'D+2'}],'downInfo':[{'name':'Essenciais','data':null},{'name':'Desempenho','data':null},{'name':'Complementares','data':null},{'name':'Regulamento','data':null},{'name':'Adesão','data':null}]}}"; + public final String LOAD_DATA_NAME = "screen"; + public final int LOAD_DATA_SIZE = 10; + + + public void getFund(){ + + } + + public void checkFund(){ + + + } + + + + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/data/template/FromInfo.java b/banco/app/src/main/java/br/banco/services/fund/data/template/FromInfo.java new file mode 100644 index 00000000..d89e644a --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/template/FromInfo.java @@ -0,0 +1,30 @@ +package br.banco.services.fund.data.template; + +import android.content.Context; +import android.support.v7.app.AppCompatActivity; + +import br.banco.services.R; +import br.banco.services.fund.data.IFundData; + +public class FromInfo extends AppCompatActivity implements IFundData { + + private Context b; + + public String configDesign(Context a) { + this.b = a; + return ""; + } + + + + public void getFund(){ + + } + + public void checkFund(){ + + + } + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/data/template/FromScreen.java b/banco/app/src/main/java/br/banco/services/fund/data/template/FromScreen.java new file mode 100644 index 00000000..4bb40144 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/template/FromScreen.java @@ -0,0 +1,263 @@ +package br.banco.services.fund.data.template; + +/** + * + * REGRAS para validar JSON + * Algumas regras podem ser definidas externamente como tamnho do arquivo: size:0 + * + */ + +import android.content.Context; +import android.support.annotation.Nullable; +import android.support.v7.app.AppCompatActivity; +import java.util.Arrays; + +import br.banco.services.fund.data.IFundData; + +public class FromScreen extends AppCompatActivity implements IFundData { + + private Context b; + + String Name; + String Data; + String Type; + int Size; + int Chars; + int Bytes; + + //---------- get external / get patern ------------- + + // public final String LOAD_DATA_DEVICE ="{'cells':[{'id':1,'type':2,'message':'Olá,primeiroseapresentecomoseunome:','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':'Gostariadecadastrarmeuemail','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}]}"; + public final String LOAD_DATA_DEVICE ="{JSON HERE}"; + + public final String LOAD_DATA_NAME = "screen"; + public final int LOAD_DATA_SIZE = 10; // fields + public final int LOAD_DATA_CHARS = 1000; // 1mb + public final int LOAD_DATA_BYTES = 5000; // nao definido + public final String LOAD_DATA_TYPE = "TEXT"; + + public FromScreen(){ + + this.Data = LOAD_DATA_DEVICE; + this.Name = LOAD_DATA_NAME; + this.Size = LOAD_DATA_SIZE; + this.Chars = LOAD_DATA_CHARS; + this.Bytes = LOAD_DATA_BYTES; + this.Type = LOAD_DATA_TYPE; + + } + + public String configDesign(Context a) { + this.b = a; + return LOAD_DATA_DEVICE; + } + + /** + * + * VALIDATORS --------------- + */ + + @Nullable + public boolean setComparetor( + String name, + String data, + String type, + int size, + int chars, + int bytes + ){ + + boolean Rules = false; + try { + + name = (name == null) ? "" : name; + data = (data == null) ? "" : data; + type = (type == null) ? "" : type; + size = (size < 1) ? 0 : size ; + chars = (chars < 1) ? 0 : chars; + bytes = (bytes < 1) ? 0 : bytes; + + Rules = getComparetor(data, LOAD_DATA_DEVICE) && + getComparetor(name, LOAD_DATA_NAME) && + getComparetor(size, LOAD_DATA_SIZE) && + getComparetor(chars, LOAD_DATA_CHARS) && + getComparetor(bytes, LOAD_DATA_BYTES)&& + getComparetor(type, LOAD_DATA_TYPE); + + } catch (Exception e) { + e.printStackTrace(); + } + return Rules; + } + + // @SuppressWarnings(); + @Nullable + public boolean getComparetor(int a, int b){ + return (a==b) || a == 0; + } + @Nullable + public boolean getComparetor(double a, double b){ + return (a==b) || a == 0; + } + @Nullable + public boolean getComparetor(boolean a, boolean b){ + return (a==b) || a == false; + } + @Nullable + public boolean getComparetor(String a, String b){ + return (a.equals(b)) || a == "" ; + } + @Nullable + public boolean getComparetor(Object a, Object b){ + return (a.equals(b)) || a == null ; + } + + /** + * + * SETERS --------------- + */ + + + public int getSize() { + return Size; + } + + public void setSize(int size) { + Size = size; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getData() { + return Data; + } + + public void setData(String data) { + Data = data; + } + + public int getChars() { + return Chars; + } + + public void setChars(int chars) { + Chars = chars; + } + + public int getBytes() { + return Bytes; + } + + public void setBytes(int bytes) { + Bytes = bytes; + } + + public String getType() { + return Type; + } + + public void setType(String type) { + Type = type; + } + + /** + * + * USER CASES retorno --------------- + */ + + public String getStringTest() { + + String nLine = System.getProperty( "line.separator" ); + + + return " " + + " ------CLASS: FromScreen----------" + nLine + nLine + + + " Name=" + Name + nLine + + " Data=" + Data + nLine + + " Type=" + Type + nLine + + " Size=" + Size + nLine + + " Chars=" + Chars + nLine + + " Bytes=" + Bytes + nLine + nLine + + + " -------------EXTERNAL-----------------" + nLine + nLine + + + " LOAD_DATA_DEVICE=" + LOAD_DATA_DEVICE + nLine + + " LOAD_DATA_NAME=" + LOAD_DATA_NAME + nLine + + " LOAD_DATA_SIZE=" + LOAD_DATA_SIZE + nLine + + " LOAD_DATA_CHARS=" + LOAD_DATA_CHARS + nLine + + " LOAD_DATA_BYTES=" + LOAD_DATA_BYTES + nLine + + " LOAD_DATA_TYPE=" + LOAD_DATA_TYPE + nLine + nLine + + + "---------------USER CASE---------------" + nLine + nLine + + " userCaseFalse=" + userCaseTrue() + nLine + + " userCaseTrue=" + userCaseFalse() + nLine + + " userCaseFalse=" + userCaseNull() + nLine + + + ""; + } + + /** + * + * USER CASES teste --------------- + */ + + + public boolean userCaseTrue(){ + + boolean usercase = false; + usercase = false; + + usercase = setComparetor( + LOAD_DATA_NAME, + LOAD_DATA_DEVICE, + LOAD_DATA_TYPE, + LOAD_DATA_SIZE, + LOAD_DATA_CHARS, + LOAD_DATA_BYTES); + + return usercase; + } + + public boolean userCaseFalse(){ + boolean usercase = false; + usercase = false; + + usercase = setComparetor( + "blablabla", + "bla bla bla", + "", + 20, + 0, + 0); + + return usercase; + } + + public boolean userCaseNull(){ + + boolean usercase = false; + usercase = false; + + usercase = setComparetor( + null, + null, + null, + -555, + -555, + -555); + + return usercase; + } + + + + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/data/template/FromType.java b/banco/app/src/main/java/br/banco/services/fund/data/template/FromType.java new file mode 100644 index 00000000..9c17ec6b --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/data/template/FromType.java @@ -0,0 +1,37 @@ +package br.banco.services.fund.data.template; + +import br.banco.services.fund.data.IFundData; + + +public enum FromType { + + FUND_TYPE { + @Override + public IFundData returnMessage() { + return new FromFund(); + } + }, + MOREINFO_TYPE { + @Override + public IFundData returnMessage() { + return new FomMoreinfo(); + } + }, + INFO_TYPE { + @Override + public IFundData returnMessage() { + return new FromInfo(); + } + }, + + DOWNLOAD_TYPE { + @Override + public IFundData returnMessage() { + return new FromDownInfo(); + } + } + ; + + public abstract IFundData returnMessage(); + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/detail/DetailAdapter.java b/banco/app/src/main/java/br/banco/services/fund/detail/DetailAdapter.java new file mode 100644 index 00000000..33de4a61 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/detail/DetailAdapter.java @@ -0,0 +1,326 @@ +package br.banco.services.fund.detail; + +/** + * + * Estas CLASSES devem ser externas para DESACOPLAR o layout e ser reaproveitavel + * + */ + +import android.content.Context; +import android.graphics.Color; +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.TextView; +import android.widget.Toast; + +import java.util.ArrayList; + +import br.banco.services.R; +import br.banco.services.fund.domain.national.Fund; +import br.banco.services.fund.domain.national.ScreenFundTemplate; + + +public class DetailAdapter extends RecyclerView.Adapter { + + private ArrayList dataSet; + Context mContext; + int total_types; + private int adapterPosition; + + + /** + * + * INICIO DO LAYOUT - FD_header, FD_body, FD_footer + * + */ + + + // inicio do body + + public static class FDFundVH extends RecyclerView.ViewHolder { + + TextView DT_fd_title; + TextView DT_fd_fundName; + TextView DT_fd_whatIs; + TextView DT_fd_definition; + TextView DT_fd_riskTitle; + LinearLayout DT_fd_chartBarLevelTemplate; + LinearLayout DT_fd_chartBarLevelTemplate_Aply; + View DT_fd_chart_arrow_4; + View DT_fd_chart_frame_4; + + public FDFundVH(View itemView) { + super(itemView); + + this.DT_fd_title = (TextView) itemView.findViewById(R.id.DT_fd_title); + this.DT_fd_fundName = (TextView) itemView.findViewById(R.id.DT_fd_fundName); + this.DT_fd_whatIs = (TextView) itemView.findViewById(R.id.DT_fd_whatIs); + this.DT_fd_definition = (TextView) itemView.findViewById(R.id.DT_fd_definition); + this.DT_fd_riskTitle = (TextView) itemView.findViewById(R.id.DT_fd_riskTitle); + + this.DT_fd_chart_arrow_4 = (View) itemView.findViewById(R.id.DT_fd_chart_arrow_4); + this.DT_fd_chart_frame_4 = (View) itemView.findViewById(R.id.DT_fd_chart_frame_4); + + } + + } + + public static class FDMoreinfoVH extends RecyclerView.ViewHolder { + + + TextView MI_lb_co1_titulo; + TextView MI_lb_co1_titulo1; + TextView MI_lb_co1_titulo2; + TextView MI_lb_co1_titulo3; + + TextView MI_lb_co2_titulo; + TextView MI_lb_co2_titulo1; + TextView MI_lb_co2_titulo2; + TextView MI_lb_co2_titulo3; + + TextView MI_lb_co3_titulo; + TextView MI_lb_co3_titulo1; + TextView MI_lb_co3_titulo2; + TextView MI_lb_co3_titulo3; + + + //TextView TV2; + // LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.template_linearlayout, null); + + public FDMoreinfoVH(View itemView) { + super(itemView); + + this.MI_lb_co1_titulo = (TextView) itemView.findViewById(R.id.MI_lb_co1_titulo); + this.MI_lb_co1_titulo1 = (TextView) itemView.findViewById(R.id.MI_lb_co1_titulo1); + this.MI_lb_co1_titulo2 = (TextView) itemView.findViewById(R.id.MI_lb_co1_titulo2); + this.MI_lb_co1_titulo3 = (TextView) itemView.findViewById(R.id.MI_lb_co1_titulo3); + + this.MI_lb_co2_titulo = (TextView) itemView.findViewById(R.id.MI_lb_co2_titulo); + this.MI_lb_co2_titulo1 = (TextView) itemView.findViewById(R.id.MI_lb_co2_titulo1); + this.MI_lb_co2_titulo2 = (TextView) itemView.findViewById(R.id.MI_lb_co2_titulo2); + this.MI_lb_co2_titulo3 = (TextView) itemView.findViewById(R.id.MI_lb_co2_titulo3); + + this.MI_lb_co3_titulo = (TextView) itemView.findViewById(R.id.MI_lb_co3_titulo); + this.MI_lb_co3_titulo1 = (TextView) itemView.findViewById(R.id.MI_lb_co3_titulo1); + this.MI_lb_co3_titulo2 = (TextView) itemView.findViewById(R.id.MI_lb_co3_titulo2); + this.MI_lb_co3_titulo3 = (TextView) itemView.findViewById(R.id.MI_lb_co3_titulo3); + + } + + } + + public static class FDInfoVH extends RecyclerView.ViewHolder { + + TextView IF_lb_co1_titulo; + TextView IF_lb_co2_titulo; + + public FDInfoVH(View itemView) { + super(itemView); + + this.IF_lb_co1_titulo = (TextView) itemView.findViewById(R.id.IF_lb_co1_titulo); + this.IF_lb_co2_titulo = (TextView) itemView.findViewById(R.id.IF_lb_co2_titulo); + + } + + } + + public static class FDDownInfoVH extends RecyclerView.ViewHolder { + + + TextView DL_lb_co1_titulo; + Button DL_lb_co2_titulo; + + public FDDownInfoVH(View itemView) { + super(itemView); + + this.DL_lb_co1_titulo = (TextView) itemView.findViewById(R.id.DL_lb_co1_titulo); + this.DL_lb_co2_titulo = (Button) itemView.findViewById(R.id.DL_lb_co2_titulo); + + } + + } + + /** + * + * FINAL DO LAYOUT - parte generica + * + */ + + + public static class FD_footer extends RecyclerView.ViewHolder { + + Button btDetailView; + + public FD_footer(View itemView) { + super(itemView); + this.btDetailView = (Button) itemView.findViewById(R.id.btDetailView); + + } + + } + + public DetailAdapter(ArrayList data, Context context) { + + this.dataSet = data; + this.mContext = context; + total_types = dataSet.size(); + + } + + @Override + public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + + View view; + switch (viewType) { + + /** + * aqui caberia um header + * + */ + + case ScreenFundTemplate.FUND_TYPE: + + view = LayoutInflater.from(parent.getContext()).inflate(R.layout.fund_detail_fund_type, parent, false); + return new FDFundVH(view); + + case ScreenFundTemplate.MOREINFO_TYPE: + + view = LayoutInflater.from(parent.getContext()).inflate(R.layout.fund_detail_moreinfo_type, parent, false); + return new FDMoreinfoVH(view); + + case ScreenFundTemplate.INFO_TYPE: + + view = LayoutInflater.from(parent.getContext()).inflate(R.layout.fund_detail_info_type, parent, false); + return new FDInfoVH(view); + + case ScreenFundTemplate.DOWNLOAD_TYPE: + + view = LayoutInflater.from(parent.getContext()).inflate(R.layout.fund_detail_download_type, parent, false); + return new FDDownInfoVH(view); + case ScreenFundTemplate.FOOTER_TYPE: + + view = LayoutInflater.from(parent.getContext()).inflate(R.layout.fund_detail_footer_type, parent, false); + return new FD_footer(view); + + } + return null; + + } + + @Override + public int getItemViewType(int position) { + + switch (dataSet.get(position).getType()) { + case 0: + return ScreenFundTemplate.FUND_TYPE; + case 1: + return ScreenFundTemplate.MOREINFO_TYPE; + case 2: + return ScreenFundTemplate.INFO_TYPE; + case 3: + return ScreenFundTemplate.DOWNLOAD_TYPE; + case 12: + return ScreenFundTemplate.FOOTER_TYPE; + default: + return -1; + } + + + } + + @Override + public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int listPosition) { + + ScreenFundTemplate model = dataSet.get(listPosition); + + + if (model != null) { + switch (model.type) { + case ScreenFundTemplate.FUND_TYPE: + + ((FDFundVH) holder).DT_fd_title.setText(model.getSession()); // fundos de.. + ((FDFundVH) holder).DT_fd_fundName.setText(model.getTitle()); // Vince.. + ((FDFundVH) holder).DT_fd_whatIs.setText(model.getSubtitle()); // o Que.. + ((FDFundVH) holder).DT_fd_definition.setText(model.getDescription()); // O fundo... + ((FDFundVH) holder).DT_fd_riskTitle.setText(model.getChartTitle()); // Grau de .. + + // LinearLayout layout = new LinearLayout(this); + + // ((FDFundVH) holder).DT_fd_chart_arrow_4.setBackgroundTintMode(); + + //((FDFundVH) holder).DT_fd_chart_arrow_4.setLayoutParams(params); + + + break; + case ScreenFundTemplate.MOREINFO_TYPE: + + /** + * aqui deve ser uma CLASSE INJETADA em oura classe + * + */ + + ((FDMoreinfoVH) holder).MI_lb_co1_titulo.setText(""); + ((FDMoreinfoVH) holder).MI_lb_co1_titulo1.setText(""+model.getTitle()); + ((FDMoreinfoVH) holder).MI_lb_co1_titulo2.setText(""+model.getTableTitle()); + ((FDMoreinfoVH) holder).MI_lb_co1_titulo3.setText(""+model.getTableValue()); + + ((FDMoreinfoVH) holder).MI_lb_co2_titulo.setText(""+model.getChartTitle()); + ((FDMoreinfoVH) holder).MI_lb_co2_titulo1.setText("0.3%"); + ((FDMoreinfoVH) holder).MI_lb_co2_titulo2.setText("12.01%"); + ((FDMoreinfoVH) holder).MI_lb_co2_titulo3.setText("17.9%"); + + ((FDMoreinfoVH) holder).MI_lb_co3_titulo.setText(""+model.getSession()); + ((FDMoreinfoVH) holder).MI_lb_co3_titulo1.setText("03%"); + ((FDMoreinfoVH) holder).MI_lb_co3_titulo2.setText("12%"); + ((FDMoreinfoVH) holder).MI_lb_co3_titulo3.setText("17.6%"); + + break; + case ScreenFundTemplate.INFO_TYPE: + + ((FDInfoVH) holder).IF_lb_co1_titulo.setText(model.getTableTitle()); + ((FDInfoVH) holder).IF_lb_co2_titulo.setText(model.getTableValue()); + + break; + case ScreenFundTemplate.DOWNLOAD_TYPE: + + ((FDDownInfoVH) holder).DL_lb_co1_titulo.setText(model.getTableTitle()); + ((FDDownInfoVH) holder).DL_lb_co2_titulo.setText(model.getAdressLabel()); + // Adress Link + + ((FDDownInfoVH) holder).DL_lb_co2_titulo.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + + Toast.makeText(mContext, "Baixando Arquivo...", Toast.LENGTH_SHORT).show(); + } + }); + + break; + case ScreenFundTemplate.FOOTER_TYPE: + + ((FD_footer) holder).btDetailView.setText(model.getAdressLabel()); + + break; + + + + + } + } + + } + + @Override + public int getItemCount() { + return dataSet.size(); + } + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/detail/DetailModel.java b/banco/app/src/main/java/br/banco/services/fund/detail/DetailModel.java new file mode 100644 index 00000000..26358d5b --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/detail/DetailModel.java @@ -0,0 +1,205 @@ +package br.banco.services.fund.detail; + + +import android.content.Context; +import android.os.Parcel; + +import java.util.ArrayList; +import java.util.List; + +import br.banco.services.app.utils.ReactAplication; +import br.banco.services.fund.data.remote.ILoadFrom; +import br.banco.services.fund.data.remote.LoadFileHttpTask; +import br.banco.services.fund.domain.national.ScreenFund; +import br.banco.services.fund.domain.national.ScreenFundTemplate; +import br.banco.services.fund.interactor.ILoadTask; +import br.banco.services.fund.interactor.LoadInternet; +import br.banco.services.fund.interactor.LoadScreen; + +public class DetailModel implements IDetail.ModelDT, ILoadTask, ILoadFrom +{ + + private static IDetail.PresenterDT presenter; + private static ILoadTask task; + + // data patern + + public static final int SITE_NATIONAL = 0; //origin + public static final int SITE_INTERNATIONAL = 1; + + public static final int LOAD_INTERNET = 0; // location + public static final int LOAD_PREFERENCES = 1; + public static final int LOAD_DATABASE = 2; + + public Context context; + public static final int INTERNET_CONN_ATTEMPTS = 3; + + // design config + + public static final int FUND_TYPE = 0; + public static final int MOREINFO_TYPE = 1; + public static final int INFO_TYPE = 2; + public static final int DOWNLOAD_TYPE = 3; + + public static final int HEADER_TYPE = 10; + public static final int BODY_TYPE = 11; + public static final int FOOTER_TYPE = 12; + + public int origin; + public int location; + + public int type; + public int data; + public String text; + + public ArrayList container; + public ArrayList configurations; + public ReactAplication RX = new ReactAplication(); + + public DetailModel(IDetail.PresenterDT presenter) { + this.origin = LOAD_INTERNET; + this.location = SITE_NATIONAL; + this.presenter = presenter; + // RX.onNext("MODEL->presenter->"+ (presenter!=null)); + + } + + public void processStart(int location ,Context c){ + this.context = c; + + // RX.onNext("MODEL->Context->"+ (c!=null)); + LoadInternet connectInternet = new LoadInternet(c); + connectInternet.delegate = this; + connectInternet.execute(""); //INTERNET_CONN_ATTEMPTS + //RX.onNext("carregar da web"); + } + + public void processFinish(String output){ + // RX.onNext("processFinish->context->" + (context!=null)); + + if(output.equals("success")) { + RX.onNext("MODEL / carregar internet..." + output); + + // LoadFileHttpTask loaadHttp = new LoadFileHttpTask(context); + // loaadHttp.delegate = this; + // loaadHttp.execute(""); + + LoadScreen loadScreen = new LoadScreen(context); + loadScreen.delegate = this; + loadScreen.execute(""); + + + }else{ + // RX.onNext("MODEL / Carregando dados locais..."); + + LoadScreen loadScreen = new LoadScreen(context); + loadScreen.delegate = this; + loadScreen.execute(""); + } + } + + public void convertFinish(List listScreen, String message){ + + if(listScreen != null) { + RX.onNext("MODEL / convertFinish->Sucess"); + // RX.onNext("MODEL / loadConfigurations->Sucess"); + // presenter.loadConfigurations(listScreen, message); + + + }else{ + RX.onNext("MODEL / convertFinish->Error"); + // presenter.loadAlert(4, context); + } + + } + + + // ------------------- config data ----------------------- + + //@Override + + + public void describeContents (){ + + } + + public void writeToParcel (Parcel dest, int flags) { + + } + + // -------------- + + + public int decideLoadData(int decide){ + decide = (decide < 0 || decide > 2 ) ? origin : decide ; + return decide; + } + + // origem dos dados + + public int getOrigin() { + return origin; + } + + public void setOrigin(int origin) { + + origin = (origin < 0 || origin > 2 ) ? 0 : origin ; + + int dataSource[] = { + LOAD_INTERNET, + LOAD_PREFERENCES, + LOAD_DATABASE + }; + + this.origin = dataSource[origin]; + } + + public int getLocation() { + return location; + } + + public void setLocation(int location) { + + location = (location < 0 || location > 1) ? 0 : location ; + + int dataSource[] = { + SITE_NATIONAL, + SITE_INTERNATIONAL + }; + + this.location = dataSource[location]; + } + + // more + + + + + + + + // conteudo + + public ArrayList getContainer() { + return container; + } + + public void setContainer(ArrayList container) { + this.container = container; + } + + //configuracoes + + public ArrayList getConfigurations() { + return configurations; + } + + public void setConfigurations(ArrayList configurations) { + this.configurations = configurations; + } + //testes + + // ------------------- config data ----------------------- + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/detail/DetailView.java b/banco/app/src/main/java/br/banco/services/fund/detail/DetailView.java new file mode 100644 index 00000000..756ae8a8 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/detail/DetailView.java @@ -0,0 +1,465 @@ +package br.banco.services.fund.detail; + +/** + * + * Sequencia de carregamento: + * + * FUND, CONTACT: + * View> Presenter-> Model> Screen> Rules> dbase[Json / Share / sqlite] + * Rules[...] listDetail = new ArrayList<>(); + + // ----- DESIGN + + private RecyclerView mRecyclerView; + private ProgressBar progressBar; + private Toolbar toolbar; + public Context context; + public ReactAplication RX = new ReactAplication(); + private int messageCode = 4; // Error + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.activity_detail_main1); + + + + if ((savedInstanceState != null) && + (savedInstanceState.getSerializable("KEY") != null)) { + + //VEW = (VIWE) savedInstanceState.getSerializable("starttime"); + } + + presenter = new DetailsPresenter(); //01 + ((DetailsPresenter) presenter).setView(this); // presenter.setView(this); + + getContext(); + drawNavigation(); + + //initProgressBar(); + //showProgressBar(); + + presenter.decideLoadContent(savedInstanceState); //02 + //RX.onNext("presenter: " + (presenter!=null)); + + // start + ArrayList list= new ArrayList(); + drawRecyclerView(); + updateRecyclerView( context, list); + + } + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + // outState.putParcelableArrayList(KEY_AREA, presenter.getScreen()); + + } + + + @Override + public void onResume() { + super.onResume(); + + // checkOnResume(); + // RX.onNext("onResume->" + getClass().getName()); + + } + + // RecyclerView + + public void drawRecyclerView(){ + mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView); + } + + public int checkOptionListView(){ + + int contItens = 0; + if (mRecyclerView.getAdapter() != null) { + contItens = mRecyclerView.getAdapter().getItemCount(); + } + return contItens; + } + + public void updateRecyclerView(Context context, ArrayList listContentData){ + + String BD_FUNDO_TITULO = "###"; + try { + + Bundle extras = getIntent().getExtras(); + + // Log.e("TESTE","extras = "+ (extras!=null)); + + if (extras != null) { + + if (extras.getString("BD_FUNDO_TITULO") != null) { + BD_FUNDO_TITULO = extras.getString("BD_FUNDO_TITULO"); + }else{ + + } + + } + + }catch (Exception ex){ + Log.e("TESTE","ERRO Bundle " ); + } + + + Log.e("TESTE","BD_FUNDO_TITULO = " + BD_FUNDO_TITULO ); + + List listaTemplate = new ArrayList(); + List listaExport = new ArrayList(); + ArrayList listScreen = new ArrayList<>(); + + + + /** + * + * 1 - Carregar um LIST contendo todos os arrays -> de> listaExport + * 2 - extrair essas arrays para detro de classes + * 3 - injetar nas classes do Recicledview + * + */ + + + + ArrayList listFund = new ArrayList(); + ArrayList listMoreingo = new ArrayList(); + ArrayList listInfo = new ArrayList(); + ArrayList listDownInfo = new ArrayList(); + + // carrgar tamanhos de database ou pacote + + int tScreen = 10; // < - carregar de pacote + int tFund = 5; + int tMoreingo = 3; + int tInfo = 8; + int tDownInfo = 4; + + ArrayList list= new ArrayList(); + + ScreenFundTemplate screen; + Fund fund = new Fund(); + fund.setDefinition("title here"); + + + + + /** + * + * HEADER, BOODY, FOOTER, outros conteudos... + * + */ + + + + // -------------------- FUNDO + + String TituloFundo ="Vinci Valorem FI Multimercado"; + if(BD_FUNDO_TITULO.length() > 2){ + TituloFundo = BD_FUNDO_TITULO; + } + + screen = new ScreenFundTemplate(fund); + screen.setType(0); + screen.setData(1); + screen.setTitle("" + TituloFundo); + screen.setSubtitle("O que é?"); // + screen.setSession("Fundos de investimento"); + screen.setDescription("O Fundo tem por objetivo proporcionar aos seus cotistas rentabilidade no longo prazo através de investimentos."); + screen.setChartTitle("Grau de risco do investimento"); + + listContentData.add(screen); + + // -------------------- MORE INFO + + /** + * + * aqui deve ser um ARRAY contendo MAPS para criar a tabela do MORE INFO + * + */ + screen = new ScreenFundTemplate(fund); + screen.setType(1); + screen.setData(1); + + screen.setTitle("No mes"); + screen.setTableTitle("No ano"); + screen.setTableValue("12 Meses"); + + screen.setChartTitle("Fundo"); + screen.setSession("CDI"); + + listContentData.add(screen); + + // -------------------- INFO + + for(int i= 0; i < 8; i++){ + + screen = new ScreenFundTemplate(screen); + screen.setType(2); + screen.setData(0); + screen.setTableTitle("Aplicação inicial " + i); + screen.setTableValue("R$ "+(i+1)+".000,00" + i); + listContentData.add(screen); + + } + + // -------------------- DOWNLOAD + + for(int b= 0; b < 5; b++){ + + screen = new ScreenFundTemplate(screen); + screen.setType(3); + screen.setData(0); + screen.setTableTitle("Essenciais" + b); + screen.setAdressLabel("BAIXAR" + b); + listContentData.add(screen); + + } + + // -------------------- FOOTER + + screen = new ScreenFundTemplate(screen); + screen.setType(12); + screen.setData(1); + screen.setAdressLabel("Investir"); + screen.setAdressLink("ACTION_CLICK"); + listContentData.add(screen); + + + + if(listContentData != null) { + + DetailAdapter adapter = new DetailAdapter(listContentData, this); + LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, OrientationHelper.VERTICAL, false); + + mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView); + + mRecyclerView.setLayoutManager(linearLayoutManager); + //mRecyclerView.setItemAnimator(new DefaultItemAnimator()); + mRecyclerView.setAdapter(adapter); + + }else{ + // presenter.loadAlert(1, context); + } + } + + // views + + public void showProgressBar() { + progressBar.setVisibility(View.VISIBLE); + } + + public void hideProgressBar() { + progressBar.setVisibility(View.INVISIBLE); + } + + public 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.RED, 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(); + + // Log.d(TAG, "VIEW / "+getClass().getName()+" -> initProgressBar" ); + + } + + public void showToolbar(){ + + toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + + // Log.d(TAG, "VIEW / "+getClass().getName()+" -> showToolbar" ); + + } + + public boolean getContext(){ + this.context = getApplicationContext(); + // Log.d(TAG, "VIEW / "+getClass().getName()+" -> getContext" ); + return (context != null); + } + + // content + + public void updateAlertView( int msgCode, Context context){ + + Handler handler; + messageCode = msgCode; + // delay + handler = new Handler(); + handler.postDelayed(new Runnable() { + @Override + public void run() { + + Intent intent; + intent = new Intent(getApplicationContext(), + br.banco.services.app.alert.AlertView.class ); + intent.putExtra("messageCode", messageCode); + startActivity(intent); + + overridePendingTransition(R.anim.an_sair, R.anim.an_entrar); + // finish(); + + } + }, 100); + + Log.d(TAG," / updateAlertView -> ERROR -> messageCode = " + messageCode); + + } + + public void checkOnResume(){ + + if(checkOptionListView() < 1){ + + Log.d(TAG, "VIEW/"+getClass().getName()+"/onResume->lOAD:0" ); + + if(ConnectionChek.isNetworkAvailable(getApplicationContext()) == true){ + + // presenter.drawOptionList(); + // presenter.decideLoadContent(STATE_KEY); //02 + + Log.d(TAG, "VIEW/"+getClass().getName()+"/onResume->DRAW" ); + + if(checkOptionListView() < 1){ + + int msgCode = 4; + presenter.loadAlert( msgCode, getApplicationContext()); + } + + }else{ + int msgCode = 2; + presenter.loadAlert( msgCode, getApplicationContext()); + } + + } + + } + + + @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_sair, R.anim.an_entrar); + return false; + } + return super.onKeyDown(keyCode, event); + } + + + @Override + public void onClick(View view) { + + Intent IT; + Context context = getApplicationContext(); + + switch (view.getId()) { + + case R.id.btAction1: + IT = new Intent(this, br.banco.services.fund.option.FundOptionView.class); + startActivity(IT); + overridePendingTransition(R.anim.an_entrar_esquerda,R.anim.an_sair_esquerda); + finish(); + break; + + + case R.id.btAction2: + IT = new Intent(this, br.banco.services.contact.ContactView.class); + startActivity(IT); + overridePendingTransition(R.anim.an_entrar_esquerda,R.anim.an_sair_esquerda); + finish(); + break; + + } + + + + } + + public void drawNavigation(){ + Button BTAction1 = (Button) findViewById(R.id.btAction1); + Button BTAction2 = (Button) findViewById(R.id.btAction2); + BTAction1.setOnClickListener(this); + BTAction2.setOnClickListener(this); + } + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/detail/DetailViewTemplate.java b/banco/app/src/main/java/br/banco/services/fund/detail/DetailViewTemplate.java new file mode 100644 index 00000000..d8cee442 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/detail/DetailViewTemplate.java @@ -0,0 +1,328 @@ +package br.banco.services.fund.detail; + +import android.content.Context; +import android.content.Intent; +import android.graphics.Color; +import android.graphics.PorterDuff; +import android.os.Bundle; +import android.os.Handler; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.OrientationHelper; +import android.support.v7.widget.RecyclerView; +import android.support.v7.widget.Toolbar; +import android.util.DisplayMetrics; +import android.util.Log; +import android.view.View; +import android.widget.ProgressBar; +import android.widget.RelativeLayout; + +import java.util.ArrayList; +import java.util.List; + +import br.banco.services.R; +import br.banco.services.app.utils.ConnectionChek; +import br.banco.services.app.utils.ReactAplication; +import br.banco.services.fund.domain.national.DownInfo; +import br.banco.services.fund.domain.national.Fund; +import br.banco.services.fund.domain.national.Info; +import br.banco.services.fund.domain.national.MoreInfo; +import br.banco.services.fund.domain.national.ScreenFund; +import br.banco.services.fund.domain.national.ScreenFundTemplate; + + +public class DetailViewTemplate extends AppCompatActivity implements + IDetail.ViewDT { //ILoadTask + + // ----- DATA + + private final String TAG ="FUND"; + private static IDetail.PresenterDT presenter; + private ScreenFund screenFund; + private ArrayList listDetail = new ArrayList<>(); + + // ----- DESIGN + + private RecyclerView mRecyclerView; + private ProgressBar progressBar; + private Toolbar toolbar; + public Context context; + public ReactAplication RX = new ReactAplication(); + private int messageCode = 4; // Error + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.activity_detail_main1); + + if ((savedInstanceState != null) && + (savedInstanceState.getSerializable("KEY") != null)) { + + //VEW = (VIWE) savedInstanceState.getSerializable("starttime"); + } + + presenter = new DetailsPresenter(); //01 + ((DetailsPresenter) presenter).setView(this); // presenter.setView(this); + + getContext(); + + //initProgressBar(); + //showProgressBar(); + + presenter.decideLoadContent(savedInstanceState); //02 + //RX.onNext("presenter: " + (presenter!=null)); + + // start + ArrayList list= new ArrayList(); + drawRecyclerView(); + updateRecyclerView( context, list); + + } + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + // outState.putParcelableArrayList(KEY_AREA, presenter.getScreen()); + + } + + + @Override + public void onResume() { + super.onResume(); + + // checkOnResume(); + // RX.onNext("onResume->" + getClass().getName()); + + } + + // RecyclerView + + public void drawRecyclerView(){ + mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView); + } + + public int checkOptionListView(){ + + int contItens = 0; + if (mRecyclerView.getAdapter() != null) { + contItens = mRecyclerView.getAdapter().getItemCount(); + } + return contItens; + } + + public void updateRecyclerView(Context context, ArrayList listContentData){ + + + List listaTemplate = new ArrayList(); + List listaExport = new ArrayList(); + + ArrayList listScreen = new ArrayList<>(); + + ArrayList listFund = new ArrayList(); + ArrayList listMoreingo = new ArrayList(); + ArrayList listInfo = new ArrayList(); + ArrayList listDownInfo = new ArrayList(); + + // carrgar tamanhos de database ou pacote + + int tScreen = 10; // < - carregar de pacote + int tFund = 5; + int tMoreingo = 3; + int tInfo = 8; + int tDownInfo = 4; + + ArrayList list= new ArrayList(); + + ScreenFundTemplate screen; + Fund fund = new Fund(); + fund.setDefinition("BOOOOO"); + + + screen = new ScreenFundTemplate(fund); +/* + // -------------------- FUND + + screen.setType(0); + screen.setData(1); + screen.setTitle(" setTitle Here"); + screen.setSubtitle(" setSubtitle Here"); + screen.setSession(" setSession Here"); + screen.setDescription(" setDescription Here setDescription Here setDescription Here setDescription Here setDescription Here setDescription Here"); + screen.setChartTitle(" setChartTitle Here"); + + listContentData.add(screen); + + // -------------------- MORE INFO + + screen = new ScreenFundTemplate(fund); + screen.setType(2); + screen.setData(1); + + screen.setTitle(" setTitle Here"); + screen.setTableTitle(" setSession"); + screen.setTableValue(" setDescription Here "); + screen.setChartTitle(" setChartTitle Here"); + + listContentData.add(screen); + + + for(int i= 0; i < 8; i++){ + + screen = new ScreenFundTemplate(screen); + screen.setType(2); + screen.setData(0); + screen.setTableTitle(" setTableTitle " + i); + screen.setTableValue(" setTableValue " + i); + listContentData.add(screen); + + } + + for(int b= 0; b < 5; b++){ + + screen = new ScreenFundTemplate(screen); + screen.setType(3); + screen.setData(0); + screen.setTableTitle(" setTableTitle " + b); + screen.setAdressLabel(" setAdressLabel " + b); + listContentData.add(screen); + + } + + */ + + // if(listContentData != null) { + + DetailAdapter adapter = new DetailAdapter(listContentData, this); + LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, OrientationHelper.VERTICAL, false); + + mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView); + + mRecyclerView.setLayoutManager(linearLayoutManager); + //mRecyclerView.setItemAnimator(new DefaultItemAnimator()); + mRecyclerView.setAdapter(adapter); + + // }else{ + // presenter.loadAlert(1, context); + // } + } + + // views + + public void showProgressBar() { + progressBar.setVisibility(View.VISIBLE); + } + + public void hideProgressBar() { + progressBar.setVisibility(View.INVISIBLE); + } + + public 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.RED, 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(); + + // Log.d(TAG, "VIEW / "+getClass().getName()+" -> initProgressBar" ); + + } + + public void showToolbar(){ + + toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + + // Log.d(TAG, "VIEW / "+getClass().getName()+" -> showToolbar" ); + + } + + public boolean getContext(){ + this.context = getApplicationContext(); + // Log.d(TAG, "VIEW / "+getClass().getName()+" -> getContext" ); + return (context != null); + } + + // content + + public void updateAlertView( int msgCode, Context context){ + + Handler handler; + messageCode = msgCode; + // delay + handler = new Handler(); + handler.postDelayed(new Runnable() { + @Override + public void run() { + + Intent intent; + intent = new Intent(getApplicationContext(), + br.banco.services.app.alert.AlertView.class ); + intent.putExtra("messageCode", messageCode); + startActivity(intent); + + overridePendingTransition(R.anim.an_sair, R.anim.an_entrar); + // finish(); + + } + }, 100); + + Log.d(TAG," / updateAlertView -> ERROR -> messageCode = " + messageCode); + + } + + public void checkOnResume(){ + + if(checkOptionListView() < 1){ + + Log.d(TAG, "VIEW/"+getClass().getName()+"/onResume->lOAD:0" ); + + if(ConnectionChek.isNetworkAvailable(getApplicationContext()) == true){ + + // presenter.drawOptionList(); + // presenter.decideLoadContent(STATE_KEY); //02 + + Log.d(TAG, "VIEW/"+getClass().getName()+"/onResume->DRAW" ); + + if(checkOptionListView() < 1){ + + int msgCode = 4; + presenter.loadAlert( msgCode, getApplicationContext()); + } + + }else{ + int msgCode = 2; + presenter.loadAlert( msgCode, getApplicationContext()); + } + + } + + } + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/detail/DetailsPresenter.java b/banco/app/src/main/java/br/banco/services/fund/detail/DetailsPresenter.java new file mode 100644 index 00000000..bbbfe59a --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/detail/DetailsPresenter.java @@ -0,0 +1,86 @@ +package br.banco.services.fund.detail; + + +import android.content.Context; +import android.os.Bundle; +import android.os.Parcel; + +import java.util.ArrayList; +import java.util.List; + +import br.banco.services.app.utils.ReactAplication; +import br.banco.services.fund.domain.national.ScreenFund; + +public class DetailsPresenter implements IDetail.PresenterDT{ + + private IDetail.ModelDT model; + private IDetail.ViewDT views; + ReactAplication RX = new ReactAplication(); + // private ScreenFund screenFund; + + private ArrayList listScreen= new ArrayList<>(); + //Context context; + private int messageCode = 4; // Error + + public DetailsPresenter(){ + + model = new DetailModel(this); + // RX.onNext("model->" + (model != null)); + + } + + public void setView(IDetail.ViewDT views){ // IDetail.ViewDT views + this.views = views; + // RX.onNext("DetailsPresenter-> setView->" + (views!=null)); + } + + public Context getContext() { + // RX.onNext("DetailsPresenter-> context->" + (context!=null)); + return (Context) views; + } + + public void decideLoadContent(Bundle savedInstanceState){ //01 + model.processStart(model.getLocation(), getContext()); + } + + // @Override + public ArrayList getScreen() { + return listScreen; + } + + + public void loadConfigurations(List listScreen, String message) + { + RX.onNext("LITA ITENS " + listScreen.size()); + + if(listScreen != null) { + + RX.onNext("LITA ITENS " + listScreen.size()); + + //views.drawInterface(ScreenFund listFund); + }else{ + int messageCode = 1; + //views.onLoadError(int messageCode); + } + + } + + public void describeContents (){ + } + + public void writeToParcel (Parcel dest, int flags) { + + } + + public void loadAlert(int msgCode, Context context){ + + // msgCode = 3; + RX.onNext("PRESENTER / loadAlert->Error"); + msgCode = (msgCode >= 0 && msgCode <= 5 ) ? msgCode : 0; + views.updateAlertView(msgCode, context); + + } + + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/detail/IDetail.java b/banco/app/src/main/java/br/banco/services/fund/detail/IDetail.java new file mode 100644 index 00000000..6f6f6a66 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/detail/IDetail.java @@ -0,0 +1,58 @@ +package br.banco.services.fund.detail; + +import android.content.Context; +import android.os.Bundle; + +import java.util.ArrayList; +import java.util.List; + + +public interface IDetail { + + + interface PresenterDT{ + + void decideLoadContent(Bundle savedInstanceState); + void loadConfigurations(List listScreen, String message); + void loadAlert(int msgCode, Context context); + + //ArrayList getScreen(); + + } + + interface ModelDT{ + + // decide origem dos dados + + void setOrigin(int origin); + int getOrigin(); + + void setLocation(int location); + int getLocation(); + + void processStart(int location ,Context c); + void processFinish(String location) ; + + ArrayList getContainer(); + ArrayList getConfigurations(); + + + } + interface ViewDT{ + + //data + + String KEY_AREA = "screen"; // screen + + //void onSuccess(int messageCode); + //void onErrorLoad(int messageCode); + void updateAlertView(int msgCode, Context c); + + + } + + + + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/domain/ClassConfiguration.java b/banco/app/src/main/java/br/banco/services/fund/domain/ClassConfiguration.java new file mode 100644 index 00000000..c7c6a38e --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/domain/ClassConfiguration.java @@ -0,0 +1,35 @@ +package br.banco.services.fund.domain; + + +public enum ClassConfiguration { + + SCREEN_CLASS("screen",10), + FUND_CLASS("fund",10), + MOREINFO_CLASS("moreInfo",3), + INFO_CLASS("info",2), + DONWNLOAD_CLASS("downInfo",2); + + ClassConfiguration(String name, int size) { + this.ClassName = name; + this.ClassSize = size; + } + + public String ClassName; + public int ClassSize; + + public String getClassName() { + return ClassName; + } + + public void setClassName(String className) { + ClassName = className; + } + + public int getClassSize() { + return ClassSize; + } + + public void setClassSize(int classSize) { + ClassSize = classSize; + } +} diff --git a/banco/app/src/main/java/br/banco/services/fund/domain/Configclass.java b/banco/app/src/main/java/br/banco/services/fund/domain/Configclass.java new file mode 100644 index 00000000..4ddd7eb2 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/domain/Configclass.java @@ -0,0 +1,36 @@ +package br.banco.services.fund.domain; + +public enum Configclass { + + + SCREEN_CLASS("screen",10), + FUND_CLASS("fund",10), + MOREINFO_CLASS("moreInfo",3), + INFO_CLASS("info",2), + DONWNLOAD_CLASS("downInfo",2); + + public String Name; + public int Size; + + Configclass(String name, int size) { + this.Name = name; + this.Size = size; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public int getSize() { + return Size; + } + + public void setSize(int size) { + Size = size; + } + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/domain/EFundDataType.java b/banco/app/src/main/java/br/banco/services/fund/domain/EFundDataType.java new file mode 100644 index 00000000..e0165d04 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/domain/EFundDataType.java @@ -0,0 +1,27 @@ +package br.banco.services.fund.domain; + +import br.banco.services.fund.data.IFundData; +import br.banco.services.fund.data.remote.FromNational; +import br.banco.services.fund.data.remote.FromInternational; + + +public enum EFundDataType { + + NATIONAL { + @Override + public IFundData returnMessage() { + return new FromNational(); + } + }, + INTERNATIONAL { + @Override + public IFundData returnMessage() { + return new FromInternational(); + } + } + + ; + + public abstract IFundData returnMessage(); + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/domain/FundTemplate.java b/banco/app/src/main/java/br/banco/services/fund/domain/FundTemplate.java new file mode 100644 index 00000000..9d3c56eb --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/domain/FundTemplate.java @@ -0,0 +1,261 @@ +package br.banco.services.fund.domain; + +import android.util.Log; + +import java.util.ArrayList; + +import br.banco.services.fund.FundModelTemplate; + +public class FundTemplate { + private String title; + private String genre; + private String year; + + + // private String Title; + + private String FundName; + private String WhatIs; + private String Definition; + private String RiskTitle; + private int Risk; + private String InfoTitle; + + /*--------*/ + + private ArrayList MoreInfo; + private ArrayList Info; + private ArrayList DownInfo; + + + public FundTemplate() { + + // this.title = title; + // this.genre = genre; + //this.year = year; + } + + // strings + + public String getFundName() { + return FundName; + } + + public void setFundName(String fundName) { + FundName = fundName; + } + + public String getWhatIs() { + return WhatIs; + } + + public void setWhatIs(String whatIs) { + WhatIs = whatIs; + } + + public String getDefinition() { + return Definition; + } + + public void setDefinition(String definition) { + Definition = definition; + } + + public String getRiskTitle() { + return RiskTitle; + } + + public void setRiskTitle(String riskTitle) { + RiskTitle = riskTitle; + } + + public int getRisk() { + return Risk; + } + + public void setRisk(int risk) { + Risk = risk; + } + + public String getInfoTitle() { + return InfoTitle; + } + + public void setInfoTitle(String infoTitle) { + InfoTitle = infoTitle; + } + + //Arrays + + + public ArrayList getMoreInfo() { + return MoreInfo; + } + + public void setMoreInfo(ArrayList moreInfo) { + MoreInfo = moreInfo; + } + + public ArrayList getInfo() { + return Info; + } + + public void setInfo(ArrayList info) { + Info = info; + } + + public ArrayList getDownInfo() { + return DownInfo; + } + + public void setDownInfo(ArrayList downInfo) { + DownInfo = downInfo; + } + + + /*------------------*/ + + public String getTitle() { + return title; + } + + public void setTitle(String name) { + this.title = name; + } + + + + + public String getYear() { + return year; + } + + public void setYear(String year) { + this.year = year; + } + + public String getGenre() { + return genre; + } + + public void setGenre(String genre) { + this.genre = genre; + } + + + + + public String[][][] getFUNDlist (int fundID, FundModelTemplate model){ + + // DataBaseTemplate model = new DataBaseTemplate(); + // 0 = fund , 1 = label, 2 = data + + String[][][] listGet = model.listMoreInfoTemplate; + String listSet[][][] = new String[][][] + { + { + { listGet[fundID][0][0],listGet[fundID][0][1] }, + { listGet[fundID][1][0],listGet[fundID][1][1] }, + { listGet[fundID][2][0],listGet[fundID][2][1] } + } + }; + + return listSet; + } + + + + + + + + + + // tests + + public void showArray(String TAG, String FUNCTION, ArrayList listValues){ + + Log.i(TAG, "@TAG: " + TAG + " / " + FUNCTION); + + if(listValues.size() == 9 || TAG != null) { + + Log.i(TAG, "Title = " + listValues.get(0)); + Log.i(TAG, "FundName = " + listValues.get(1)); + Log.i(TAG, "WhatIs = " + listValues.get(2)); + Log.i(TAG, "Definition = " + listValues.get(3)); + Log.i(TAG, "RiskTitle = " + listValues.get(4)); + Log.i(TAG, "Risk = " + listValues.get(5)); + Log.i(TAG, "InfoTitle = " + listValues.get(6)); + + Log.i(TAG, "moreInfo = " + listValues.get(6)); + Log.i(TAG, "info = " + listValues.get(7)); + Log.i(TAG, "downInfo = " + listValues.get(8)); + + }else{ + Log.e(TAG, "Erro: @TAG: " + TAG + " / " + FUNCTION + " lista incompleta!" ); + } + } + + + + public void showClass(String TAG, String FUNCTION, FundTemplate fund){ + + Log.i(TAG, "@TAG: " + TAG + " / " + FUNCTION); + + if( fund!=null && TAG != null) { + + Log.d(TAG, " fund.getTitle() = " + fund.getTitle()); + Log.d(TAG, " fund.getFundName() = " + fund.getFundName()); + Log.d(TAG, " fund.getWhatIs() = " + fund.getWhatIs()); + Log.d(TAG, " fund.getDefinition() = " + fund.getDefinition()); + Log.d(TAG, " fund.getRiskTitle() = " + fund.getRiskTitle()); + Log.d(TAG, " fund.getRisk() = " + fund.getRisk()); + Log.d(TAG, " fund.getInfoTitle() = " + fund.getInfoTitle()); + + Log.d(TAG, " fund.getMoreInfo() = " + fund.getMoreInfo()); + Log.d(TAG, " fund.getInfo() = " + fund.getInfo()); + Log.d(TAG, " fund.getDownInfo() = " + fund.getDownInfo()); + + }else{ + Log.e(TAG, "Erro: @TAG: " + TAG + " / " + FUNCTION + " objeto nulo!" ); + } + } + + + + + + public void showListDetail(int fundID){ + + FundModelTemplate model = new FundModelTemplate(); + String[][][] list = model.listMoreInfoTemplate; + String listCopy[][][] = new String[][][] + { + { + { list[fundID][0][0], list[fundID][0][1] }, + { list[fundID][0][0],list[fundID][1][1] }, + { list[fundID][0][0],list[fundID][2][1] } + } + }; + + if(listCopy.length > 0) { + + Log.d("FUND", "FUNDO DETALHE / showListMOREINFOdetail => [" + fundID + "] "); + + Log.d("FUND", "NOME = " + listCopy[0][0][0] + " : " + listCopy[0][0][1] ); + Log.d("FUND", "MES = " + listCopy[0][1][0] + " : " + listCopy[0][1][1] ); + Log.d("FUND", "12MESES = " + listCopy[0][2][0] + " : " + listCopy[0][2][1] ); + Log.d("FUND", " ----------------------------------------- "); + + }else{ + + Log.d("FUND","showListMOREINFOdetail -> listMoreInfoTemplate -> VAZIA "); + } + } + + + + + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/domain/national/Conteiner.java b/banco/app/src/main/java/br/banco/services/fund/domain/national/Conteiner.java new file mode 100644 index 00000000..c32e4d89 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/domain/national/Conteiner.java @@ -0,0 +1,21 @@ +package br.banco.services.fund.domain.national; + +import java.util.ArrayList; +import java.util.List; + + +public class Conteiner { + + private final Class type; + public String Value; + + public Conteiner (String Value, Class type) { + this.type = type; + this.Value = Value; + } + + public Class getType() { + return this.type; + } + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/domain/national/DownInfo.java b/banco/app/src/main/java/br/banco/services/fund/domain/national/DownInfo.java new file mode 100644 index 00000000..953a9b37 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/domain/national/DownInfo.java @@ -0,0 +1,47 @@ +package br.banco.services.fund.domain.national; + +import java.util.HashMap; +import java.util.Map; + +public class DownInfo { + + //JsonProperty("name") + private String name; + //JsonProperty("data") + private Object data; + //JsonIgnore + private Map additionalProperties = new HashMap(); + + //JsonProperty("name") + public String getName() { + return name; + } + + //JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + //JsonProperty("data") + public Object getData() { + return data; + } + + //JsonProperty("data") + public void setData(Object data) { + this.data = data; + } + + //JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + //JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + + +} \ No newline at end of file diff --git a/banco/app/src/main/java/br/banco/services/fund/domain/national/Fund.java b/banco/app/src/main/java/br/banco/services/fund/domain/national/Fund.java new file mode 100644 index 00000000..f43d2eb2 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/domain/national/Fund.java @@ -0,0 +1,160 @@ +package br.banco.services.fund.domain.national; + +import android.os.Parcelable; + +import java.util.ArrayList; + +import br.banco.services.fund.domain.FundTemplate; + +public class Fund { + + + + public static final int MOREINFO_TYPE = 0; + + private String Title; + private String FundName; + private String WhatIs; + private String Definition; + private String RiskTitle; + private int Risk; + private String InfoTitle; + + // Arrays + + private ArrayList MoreInfo; + private ArrayList Info; + private ArrayList DownInfo; + + public Fund() { + + } + + // String + + + public String getTitle() { + return Title; + } + + public void setTitle(String title) { + Title = title; + } + + public String getFundName() { + return FundName; + } + + public void setFundName(String fundName) { + FundName = fundName; + } + + public String getWhatIs() { + return WhatIs; + } + + public void setWhatIs(String whatIs) { + WhatIs = whatIs; + } + + public String getDefinition() { + return Definition; + } + + public void setDefinition(String definition) { + Definition = definition; + } + + public String getRiskTitle() { + return RiskTitle; + } + + public void setRiskTitle(String riskTitle) { + RiskTitle = riskTitle; + } + + public int getRisk() { + return Risk; + } + + public void setRisk(int risk) { + Risk = risk; + } + + public String getInfoTitle() { + return InfoTitle; + } + + public void setInfoTitle(String infoTitle) { + InfoTitle = infoTitle; + } + + //Arrays + + public ArrayList getMoreInfo() { + return MoreInfo; + } + + public void setMoreInfo(ArrayList moreInfo) { + MoreInfo = moreInfo; + } + + public ArrayList getInfo() { + return Info; + } + + public void setInfo(ArrayList info) { + Info = info; + } + + public ArrayList getDownInfo() { + return DownInfo; + } + + public void setDownInfo(ArrayList downInfo) { + DownInfo = downInfo; + } + + + // risk + + public String[][][] getRiskList (int risk, FundTemplate model){ + + String[][][] listGet ={}; + + /* + String listSet[][][] = new String[][][] + { + { + { listGet[risk][0][0],listGet[risk][0][1] }, + { listGet[risk][1][0],listGet[risk][1][1] }, + { listGet[risk][2][0],listGet[risk][2][1] } + } + }; +*/ + return listGet; + + } + + + public void setFundTemplate() { + + //FromType fund = new FromType(); + + this.Title = "@Fundos de investimento" ; + this.FundName = "@Vinci Valorem FI Multimercado" ;; + this.WhatIs = "@O que é?" ;; + this.Definition = "@O Fundo tem por objetivo proporcionar aos seus cotistas rentabilidade no longo prazo através de investimentos." ;; + this.RiskTitle = "@Grau de risco do investimento" ;; + this.Risk = 4 ; + this.InfoTitle = "@Mais informações sobre o investimento" ;; + // Arrays + + this.MoreInfo = null ; + this.Info = null ; + this.DownInfo = null ; + } + + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/domain/national/FundParcel.java b/banco/app/src/main/java/br/banco/services/fund/domain/national/FundParcel.java new file mode 100644 index 00000000..1c67f9a8 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/domain/national/FundParcel.java @@ -0,0 +1,35 @@ +package br.banco.services.fund.domain.national; + +import android.os.Parcelable; + +import java.util.ArrayList; + +public abstract class FundParcel implements Parcelable { + + + public static final int MOREINFO_TYPE = 0; + + private String Title; + private String FundName; + private String WhatIs; + private String Definition; + private String RiskTitle; + private int Risk; + private String InfoTitle; + + // Arrays + + private ArrayList MoreInfo; + private ArrayList Info; + private ArrayList DownInfo; + + public FundParcel() { + //setFundTemplate(); + } + + + + + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/domain/national/Info.java b/banco/app/src/main/java/br/banco/services/fund/domain/national/Info.java new file mode 100644 index 00000000..773ec582 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/domain/national/Info.java @@ -0,0 +1,45 @@ +package br.banco.services.fund.domain.national; + +import java.util.HashMap; +import java.util.Map; + +public class Info { + + //JsonProperty("name") + private String name; + //JsonProperty("data") + private String data; + //JsonIgnore + private Map additionalProperties = new HashMap(); + + //JsonProperty("name") + public String getName() { + return name; + } + + //JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + //JsonProperty("data") + public String getData() { + return data; + } + + //JsonProperty("data") + public void setData(String data) { + this.data = data; + } + + //JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + //JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + +} \ No newline at end of file diff --git a/banco/app/src/main/java/br/banco/services/fund/domain/national/Month.java b/banco/app/src/main/java/br/banco/services/fund/domain/national/Month.java new file mode 100644 index 00000000..daba7aef --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/domain/national/Month.java @@ -0,0 +1,45 @@ +package br.banco.services.fund.domain.national; + +import java.util.HashMap; +import java.util.Map; + +public class Month { + + //JsonProperty("fund") + private Double fund; + //JsonProperty("CDI") + private Double cDI; + //JsonIgnore + private Map additionalProperties = new HashMap(); + + //JsonProperty("fund") + public Double getFund() { + return fund; + } + + //JsonProperty("fund") + public void setFund(Double fund) { + this.fund = fund; + } + + //JsonProperty("CDI") + public Double getCDI() { + return cDI; + } + + //JsonProperty("CDI") + public void setCDI(Double cDI) { + this.cDI = cDI; + } + + //JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + //JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + +} \ No newline at end of file diff --git a/banco/app/src/main/java/br/banco/services/fund/domain/national/MonthSimulation.java b/banco/app/src/main/java/br/banco/services/fund/domain/national/MonthSimulation.java new file mode 100644 index 00000000..b763345e --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/domain/national/MonthSimulation.java @@ -0,0 +1,45 @@ +package br.banco.services.fund.domain.national; + +import java.util.HashMap; +import java.util.Map; + +public class MonthSimulation { + + //JsonProperty("fund") + private Double fund; + //JsonProperty("CDI") + private Double cDI; + //JsonIgnore + private Map additionalProperties = new HashMap(); + + //JsonProperty("fund") + public Double getFund() { + return fund; + } + + //JsonProperty("fund") + public void setFund(Double fund) { + this.fund = fund; + } + + //JsonProperty("CDI") + public Double getCDI() { + return cDI; + } + + //JsonProperty("CDI") + public void setCDI(Double cDI) { + this.cDI = cDI; + } + + //JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + //JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + +} \ No newline at end of file diff --git a/banco/app/src/main/java/br/banco/services/fund/domain/national/MoreInfo.java b/banco/app/src/main/java/br/banco/services/fund/domain/national/MoreInfo.java new file mode 100644 index 00000000..29c8cfd3 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/domain/national/MoreInfo.java @@ -0,0 +1,59 @@ +package br.banco.services.fund.domain.national; + +import java.util.HashMap; +import java.util.Map; + +public class MoreInfo { + + //JsonProperty("month") + private Month month; + //JsonProperty("year") + private Year year; + //JsonProperty("12months") + private MonthSimulation MonthSimulation; + //JsonIgnore + private Map additionalProperties = new HashMap(); + + //JsonProperty("month") + public Month getMonth() { + return month; + } + + //JsonProperty("month") + public void setMonth(Month month) { + this.month = month; + } + + //JsonProperty("year") + public Year getYear() { + return year; + } + + //JsonProperty("year") + public void setYear(Year year) { + this.year = year; + } + + //JsonProperty("12months") + public MonthSimulation getSimulation() { + return MonthSimulation; + } + + //JsonProperty("12months") + public void setSimulation(MonthSimulation MonthSimulation) { + this.MonthSimulation = MonthSimulation; + } + + //JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + //JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + + +} \ No newline at end of file diff --git a/banco/app/src/main/java/br/banco/services/fund/domain/national/NationalFund.java b/banco/app/src/main/java/br/banco/services/fund/domain/national/NationalFund.java new file mode 100644 index 00000000..d5fa943b --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/domain/national/NationalFund.java @@ -0,0 +1,108 @@ +package br.banco.services.fund.domain.national; + +public class NationalFund { + + // public String screen; + public String title; + public String fundName; + public String whatIs; + public String definition; + public String riskTitle; + public String risk; + public String infoTitle; + public String moreInfo; + public String info; + public String downInfo; + + /* + public String getScreen() { + return screen; + } + + public void setScreen(String screen) { + this.screen = screen; + } + */ + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getFundName() { + return fundName; + } + + public void setFundName(String fundName) { + this.fundName = fundName; + } + + public String getWhatIs() { + return whatIs; + } + + public void setWhatIs(String whatIs) { + this.whatIs = whatIs; + } + + public String getDefinition() { + return definition; + } + + public void setDefinition(String definition) { + this.definition = definition; + } + + public String getRiskTitle() { + return riskTitle; + } + + public void setRiskTitle(String riskTitle) { + this.riskTitle = riskTitle; + } + + public String getRisk() { + return risk; + } + + public void setRisk(String risk) { + this.risk = risk; + } + + public String getInfoTitle() { + return infoTitle; + } + + public void setInfoTitle(String infoTitle) { + this.infoTitle = infoTitle; + } + + public String getMoreInfo() { + return moreInfo; + } + + public void setMoreInfo(String moreInfo) { + this.moreInfo = moreInfo; + } + + public String getInfo() { + return info; + } + + public void setInfo(String info) { + this.info = info; + } + + public String getDownInfo() { + return downInfo; + } + + public void setDownInfo(String downInfo) { + this.downInfo = downInfo; + } + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/domain/national/Screen.java b/banco/app/src/main/java/br/banco/services/fund/domain/national/Screen.java new file mode 100644 index 00000000..eee0a963 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/domain/national/Screen.java @@ -0,0 +1,25 @@ +package br.banco.services.fund.domain.national; + + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class Screen { + + public int id; + public String title; + public String fundName; + public String whatIs; + + public String definition; + public String riskTitle; + public String risk; + + public String infoTitle; + public String moreInfo; + public String info; + + public String downInfo; + +} \ No newline at end of file diff --git a/banco/app/src/main/java/br/banco/services/fund/domain/national/ScreenFund.java b/banco/app/src/main/java/br/banco/services/fund/domain/national/ScreenFund.java new file mode 100644 index 00000000..970099af --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/domain/national/ScreenFund.java @@ -0,0 +1,57 @@ +package br.banco.services.fund.domain.national; + +import android.os.Parcel; +import android.os.Parcelable; + +public class ScreenFund { + + + int id; + String Header; + String Body; + String Footer; + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getHeader() { + return Header; + } + + public void setHeader(String header) { + Header = header; + } + + public String getBody() { + return Body; + } + + public void setBody(String body) { + Body = body; + } + + public String getFooter() { + return Footer; + } + + public void setFooter(String footer) { + Footer = footer; + } + + + //@Override + public int describeContents () { + return 0; + } + + //@Override + + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/domain/national/ScreenFundParcel.java b/banco/app/src/main/java/br/banco/services/fund/domain/national/ScreenFundParcel.java new file mode 100644 index 00000000..07f2ce6e --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/domain/national/ScreenFundParcel.java @@ -0,0 +1,83 @@ +package br.banco.services.fund.domain.national; + +import android.os.Parcel; +import android.os.Parcelable; + +public class ScreenFundParcel implements Parcelable { + + public static final String ID_KEY = "id"; + public static final String KEY_FAVORITE = "key-favorite"; + + int id; + String Header; + String Body; + String Footer; + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getHeader() { + return Header; + } + + public void setHeader(String header) { + Header = header; + } + + public String getBody() { + return Body; + } + + public void setBody(String body) { + Body = body; + } + + public String getFooter() { + return Footer; + } + + public void setFooter(String footer) { + Footer = footer; + } + + + //@Override + public int describeContents () { + return 0; + } + + //@Override + public void writeToParcel (Parcel dest, int flags) { + + dest.writeLong (id); + dest.writeString (Header); + dest.writeString (Body); + dest.writeString (Footer); + } + + public ScreenFundParcel(Parcel in) { + + this.id = in.readInt(); + this.Header = in.readString(); + this.Body = in.readString(); + this.Footer = in.readString(); + } + + public static final Creator CREATOR = new Creator () { + public ScreenFundParcel createFromParcel (Parcel source) { + return new ScreenFundParcel(source); + } + + @Override + public ScreenFundParcel[] newArray (int size) { + return new ScreenFundParcel[size]; + } + }; + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/domain/national/ScreenFundTemplate.java b/banco/app/src/main/java/br/banco/services/fund/domain/national/ScreenFundTemplate.java new file mode 100644 index 00000000..18d5d71f --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/domain/national/ScreenFundTemplate.java @@ -0,0 +1,245 @@ +package br.banco.services.fund.domain.national; + +import java.util.ArrayList; + +import br.banco.services.fund.domain.national.ScreenFund; +import br.banco.services.fund.domain.national.ScreenFundTemplate; +import br.banco.services.fund.domain.national.Fund; +import br.banco.services.fund.domain.national.DownInfo; +import br.banco.services.fund.domain.national.Info; +import br.banco.services.fund.domain.national.MoreInfo; + +public class ScreenFundTemplate { + + public static final String ID_KEY = "id"; + public static final String KEY_FAVORITE = "key-favorite"; + + /** + * Definicoes de layout + * + */ + + public static final int HEADER_TYPE = 10; + public static final int BODY_TYPE = 11; + public static final int FOOTER_TYPE = 12; + + public static final int FUND_TYPE = 0; + public static final int MOREINFO_TYPE = 1; + public static final int INFO_TYPE = 2; + public static final int DOWNLOAD_TYPE = 3; + + + public int origin; + public int location; + + public int type; + public int data; + public String text; + + // ---------------- LAYOUT / TELA ----------------------- + + public String Title; + public String Subtitle; + + public String Session; + public String Description; + + public String ChartTitle; + public ArrayList Chart; + + public String AdressLink; + public String AdressLabel; + + public String TableTitle; + public String TableValue; + + + public String getTitle() { + return Title; + } + + public void setTitle(String title) { + Title = title; + } + + public String getSubtitle() { + return Subtitle; + } + + public void setSubtitle(String subtitle) { + Subtitle = subtitle; + } + + public String getSession() { + return Session; + } + + public void setSession(String session) { + Session = session; + } + + public String getDescription() { + return Description; + } + + public void setDescription(String description) { + Description = description; + } + + public String getChartTitle() { + return ChartTitle; + } + + public void setChartTitle(String chartTitle) { + ChartTitle = chartTitle; + } + + public ArrayList getChart() { + + // Chart.add("03%"); + // Chart.add("12%"); + // Chart.add("17%"); + + return Chart; + } + + public void setChart(ArrayList chart) { + + // chart.add("03%"); + // chart.add("12%"); + // chart.add("17%"); + + Chart = chart; + } + + public String getAdressLink() { + return AdressLink; + } + + public void setAdressLink(String adressLink) { + AdressLink = adressLink; + } + + public String getAdressLabel() { + return AdressLabel; + } + + public void setAdressLabel(String adressLabel) { + AdressLabel = adressLabel; + } + + public String getTableTitle() { + return TableTitle; + } + + public void setTableTitle(String tableTitle) { + TableTitle = tableTitle; + } + + public String getTableValue() { + return TableValue; + } + + public void setTableValue(String tableValue) { + TableValue = tableValue; + } + + public ScreenFundTemplate(Object object){ + + + + } + + + + /** + * Definicoes de dados IMAGEM, TEXTO, ETC + * + */ + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public int getData() { + return data; + } + + public void setData(int data) { + this.data = data; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + + + + /** + * Definicoes de layout - CAMPOS + * + */ + + + int id; + String Header; + String Body; + String Footer; + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getHeader() { + return Header; + } + + public void setHeader(String header) { + Header = header; + } + + public String getBody() { + return Body; + } + + public void setBody(String body) { + Body = body; + } + + public String getFooter() { + return Footer; + } + + public void setFooter(String footer) { + Footer = footer; + } + + + + + + + + + + + + + + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/domain/national/Year.java b/banco/app/src/main/java/br/banco/services/fund/domain/national/Year.java new file mode 100644 index 00000000..8a395531 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/domain/national/Year.java @@ -0,0 +1,45 @@ +package br.banco.services.fund.domain.national; + +import java.util.HashMap; +import java.util.Map; + +public class Year { + + //JsonProperty("fund") + private Double fund; + //JsonProperty("CDI") + private Double cDI; + //JsonIgnore + private Map additionalProperties = new HashMap(); + + //JsonProperty("fund") + public Double getFund() { + return fund; + } + + //JsonProperty("fund") + public void setFund(Double fund) { + this.fund = fund; + } + + //JsonProperty("CDI") + public Double getCDI() { + return cDI; + } + + //JsonProperty("CDI") + public void setCDI(Double cDI) { + this.cDI = cDI; + } + + //JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + //JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + +} \ No newline at end of file diff --git a/banco/app/src/main/java/br/banco/services/fund/interactor/CompareClass.java b/banco/app/src/main/java/br/banco/services/fund/interactor/CompareClass.java new file mode 100644 index 00000000..333021ad --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/interactor/CompareClass.java @@ -0,0 +1,55 @@ +package br.banco.services.fund.interactor; + +import android.util.Log; +import br.banco.services.fund.data.template.FromFund; +import static br.banco.services.fund.domain.Configclass.*; + +public class CompareClass { + + + public boolean compareClass(Class clas1, Class clas2 ){ + + boolean equals = false; + try { + + equals = (clas1.getClass().equals( clas1.getClass() )); + + }catch (Exception e){ + Log.e("FUND", " "+getClass().getName()+"->ERROR!-> " + e.getMessage()); + } + return (equals); + } + + + + public boolean compareClassAndData(FromFund fromFund){ + + // comparar se as config da classe sao iguais aos dados + 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.e("FUND", " "+getClass().getName()+"->ERROR!-> " + e.getMessage()); + } + + return (nameAll && sizeAll) ; + } + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/interactor/ConvertGson.java b/banco/app/src/main/java/br/banco/services/fund/interactor/ConvertGson.java new file mode 100644 index 00000000..8b82c5cb --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/interactor/ConvertGson.java @@ -0,0 +1,67 @@ +package br.banco.services.fund.interactor; + +import android.content.Context; +import android.os.AsyncTask; +import android.util.Log; +import com.google.gson.Gson; +import com.google.gson.JsonSyntaxException; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +import br.banco.services.fund.domain.national.NationalFund; + +public class ConvertGson { + + public ILoadTask delegate = null; + public List nacional = new ArrayList(); + + public ConvertGson(Context context) { + // do here + } + + public class ConvertOrigin extends AsyncTask { + + + protected void onPreExecute() { + + Log.d("FUND", "onPreExecute -> START " ); + } + + @Override + protected NationalFund doInBackground(String... strings) { + + String dataReceived = "" + strings[0]; + try { + + String jsDados = dataReceived; + Gson GS = new Gson(); + + return GS.fromJson(jsDados, NationalFund.class); // fromJson - toJson + + } catch (JsonSyntaxException e) { + Log.d("FUND", "doInBackground -> ERRO " ); + e.printStackTrace(); + return null; + } + + } + + @Override + protected void onPostExecute(NationalFund response) { + + String message = "sucess"; + String content = "content here" ; // + response + + // delegate.convertFinish(content, message); + Log.d("FUND", "onPostExecute -> SUCESS -> " + response ); + + } + + } + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/interactor/ConvertGsonFormat.java b/banco/app/src/main/java/br/banco/services/fund/interactor/ConvertGsonFormat.java new file mode 100644 index 00000000..bf951c66 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/interactor/ConvertGsonFormat.java @@ -0,0 +1,18 @@ +package br.banco.services.fund.interactor; + +import java.util.ArrayList; +import java.util.List; + +import br.banco.services.fund.domain.national.NationalFund; + +public class ConvertGsonFormat { + + private List nacional = new ArrayList(); + + public List listGsonFormat() { + return nacional; + } + + + +} \ No newline at end of file diff --git a/banco/app/src/main/java/br/banco/services/fund/interactor/ConvertGsonSimple.java b/banco/app/src/main/java/br/banco/services/fund/interactor/ConvertGsonSimple.java new file mode 100644 index 00000000..675ddada --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/interactor/ConvertGsonSimple.java @@ -0,0 +1,53 @@ +package br.banco.services.fund.interactor; + +import android.content.Context; +import android.os.AsyncTask; +import android.util.JsonReader; +import android.util.Log; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonSyntaxException; +import com.google.gson.GsonBuilder; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +import org.json.JSONArray; +import org.json.JSONObject; + +import java.io.StringReader; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import br.banco.services.fund.domain.national.NationalFund; +import br.banco.services.fund.domain.national.Screen; + + + +public class ConvertGsonSimple { + + //public List nacional = new ArrayList(); + public ConvertGsonSimple() { } + + public void convertGS(String dataOrigin) { + + + try{ + + String message = null; + Gson gson = new Gson(); + + + }catch (Exception e){ + Log.d("FUND", "" + e); + } + + + } + +} + diff --git a/banco/app/src/main/java/br/banco/services/fund/interactor/ConvertJson.java b/banco/app/src/main/java/br/banco/services/fund/interactor/ConvertJson.java new file mode 100644 index 00000000..2f835efa --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/interactor/ConvertJson.java @@ -0,0 +1,348 @@ +package br.banco.services.fund.interactor; + +import android.util.Log; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; + +import org.json.JSONTokener; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONStringer; + +import java.io.FileReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.lang.reflect.*; +import java.util.Arrays; +import java.util.Collections; +import java.lang.reflect.Method; + + +import br.banco.services.app.utils.ReactAplication; +import br.banco.services.fund.domain.national.Screen; + + +public class ConvertJson { + + public Map dataToMap; + public JSONObject jsonObject; + public String stringClass; + public String arrayCompare; + public int integerTotal; + public Screen screen; + + public String messageTask; + ReactAplication RX; + + //private Throwable throwable; + // private static Method method; + + + public ArrayList arrayClass; + public ArrayList arrayJson; + public boolean compareArrays; + + public ConvertJson(){ + + this.RX = new ReactAplication(); + jsonObject = new JSONObject(); + dataToMap = new HashMap(); + stringClass = new String(); + arrayClass = new ArrayList<>(); + arrayJson = new ArrayList<>(); + compareArrays = false; + } + + + // BUSINESS //Class classFrom + public void onStartTask(String packageStr, String jsonStr){ + + try { + + Class classTo = Class.forName(packageStr); + String className = classTo.getSimpleName().toLowerCase(); + + jsonObject = stringToJson(jsonStr, className); + dataToMap = jsonToMap(jsonObject); + arrayClass = classToArray(jsonObject , classTo); + arrayJson = jsonToArray(jsonObject); + compareArrays = compareArrays(arrayClass, arrayJson); + + messageTask = className; + + RX.onNext(messageTask); + } catch (Exception e) { + onErrorTask(e, messageTask); + } + + + } + + public void onErrorTask(Throwable e, String message){ + + // Log.d("FUND", arrayClass.size() + " onErrorTask: " + message ); + + } + + public void onSucessTask(){ + // delegate + + + Log.d("FUND", arrayClass.size() + " onSucess: " + messageTask ); + } + + + + + + // CONVERTER --------------------- + + + + + + public JSONObject createJson(String strValue) { + + try{ + + JSONObject json = new JSONObject(strValue); + //json.put(strValue); + + RX.onNext("" + (json!=null)); + return json; + + } catch (Exception e) { + //onError(e); + + RX.onError(e); + return null; + } + + } + + public JSONObject createJsonTree(String K1, String V1, String K2, String V2) { + + JSONObject json = null; + + try { + + json = new JSONObject(); + json.put(K1, V1); + + JSONArray jsonSon = new JSONArray(); + jsonSon.put(K2); + jsonSon.put(V2); + + json.put("SON", jsonSon); + + RX.onNext(""+(json!=null)); + }catch (JSONException e){ + RX.onError(e); + } + + return json; + } + + // OK + public JSONObject stringToJson(String classString, String className) { + + try{ + + JSONObject json = new JSONObject(classString); + JSONObject jsonConvert = json.getJSONObject(className); + + RX.onNext("" + (jsonConvert!=null)); + return jsonConvert; + + } catch (Exception e) { + //onError(e); + + RX.onError(e); + return null; + } + + } + + // OK + public Map jsonToMap(JSONObject json){ + Map dataMap = new HashMap(); + try { + JSONObject mainObj = json; + for(int i = 0; i classToArray(JSONObject json, Class clas){ + + ArrayList arrayClass = null; + + try { + arrayClass = new ArrayList<>(); + Field[] fields = clas.getDeclaredFields(); + int fieldCount = fields.length; + for(Field f : fields){ + f.setAccessible(true); + if(!(f.getName().equals("id") || + f.getName().equals("$change") || + f.getName().equals("serialVersionUID"))){ + arrayClass.add(f.getName()); + } + // Log.d("FUND", f.getName() + " / " + f.getType() ); + } + // Log.d("FUND", arrayClass.size() + " / " + fieldCount ); + RX.onNext("size: " +(arrayClass.size() > 0)); + }catch ( Exception e){ + RX.onError(e); + } + return arrayClass; + } + + // OK + public ArrayList jsonToArray(JSONObject json){ + ArrayList dataArray = null; + try { + dataArray =new ArrayList(); + JSONObject mainObj = json; + for(int i = 0; i array1, ArrayList array2){ + boolean compare = false; + try { + Collections.sort(array1); + Collections.sort(array2); + compare = (array1.equals(array2)); + RX.onNext("bool:" + (compare)); + } catch (Exception e) { + // e.printStackTrace(); + RX.onError(e); + } + return (compare); + } + + + //UTILIZAR --------------------- + + + // -> AINDA EM TESTE + + public int getColumnFromClass(Class classActual) { + int count = 0; + + try{ + + Field[] fields = classActual.getDeclaredFields(); + String fieldName; + Class fieldType; + int fieldCount = fields.length; + + + for (Field field : fields) { + + if (!field.isAccessible()) field.setAccessible(true); + fieldName = field.getName(); + fieldType = field.getType(); + + if (fieldName.compareTo("") == 0) { + continue; + } + + if (count == fieldCount - 1) { + Log.d("FUND", field.getName() + " == " + fieldType); + } else { + + } + + count++; + + } + }catch (Exception e){ + RX.onError(e); + } + + return count; + } + + public static Map loadMap(JSONObject json) throws JSONException { + + Map retMap = new HashMap(); + + if(json != JSONObject.NULL) { + retMap = jsonToMap2(json); + } + return retMap; + } + + public static Map jsonToMap2(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 = jsonToMap2((JSONObject) value); + } + map.put(key, value); + } + return map; + } + + public static List jsonToList(JSONArray array) throws JSONException { + + List list = new ArrayList(); + + for(int i = 0; i < array.length(); i++) { + Object value = array.get(i); + if(value instanceof JSONArray) { + value = jsonToList((JSONArray) value); + } + + else if(value instanceof JSONObject) { + value = jsonToMap2((JSONObject) value); + } + list.add(value); + } + + return list; + } + +} + diff --git a/banco/app/src/main/java/br/banco/services/fund/interactor/ConvertJsonToArray.java b/banco/app/src/main/java/br/banco/services/fund/interactor/ConvertJsonToArray.java new file mode 100644 index 00000000..1ce7edb6 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/interactor/ConvertJsonToArray.java @@ -0,0 +1,451 @@ +package br.banco.services.fund.interactor; +import android.util.Log; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import br.banco.services.app.utils.ReactAplication; + +// screen=str, info=array, downInfo=array , moreInfo=str + +public class ConvertJsonToArray { + + public JSONObject objZero; + public JSONObject objOne ; + public JSONObject objTwo ; + public JSONObject objTree ; + + JSONArray arrayOne; + JSONArray arrayTwo; + + + + public ReactAplication RX; + public ConvertJsonToArray(){ + 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/banco/app/src/main/java/br/banco/services/fund/interactor/ConvertJsonTypes.java b/banco/app/src/main/java/br/banco/services/fund/interactor/ConvertJsonTypes.java new file mode 100644 index 00000000..25cffc07 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/interactor/ConvertJsonTypes.java @@ -0,0 +1,261 @@ +package br.banco.services.fund.interactor; + +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 ConvertJsonTypes { + + + 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 jsonToList(JSONArray array) throws JSONException { + + List list = new ArrayList(); + + for(int i = 0; i < array.length(); i++) { + Object value = array.get(i); + if(value instanceof JSONArray) { + value = jsonToList((JSONArray) value); + } + + else if(value instanceof JSONObject) { + value = jsonToMap((JSONObject) value); + } + list.add(value); + } + + return list; + } + + public String[] convertToArray(String start){ + String[] resultValue = {}; + + return resultValue; + } + + public ArrayList convertToString(String start){ + ArrayList resultValue = null ; + + return resultValue; + } + +} + + +/* +dataToMap.put("fundName", mainObj.getString("fundName")); +dataToMap.put("whatIs", mainObj.getString("whatIs")); +dataToMap.put("definition", mainObj.getString("definition")); +dataToMap.put("riskTitle", mainObj.getString("riskTitle")); +dataToMap.put("risk", mainObj.getString("risk")); +dataToMap.put("infoTitle", mainObj.getString("infoTitle")); +dataToMap.put("moreInfo", mainObj.getString("moreInfo")); +dataToMap.put("info", mainObj.getString("info")); +dataToMap.put("downInfo", mainObj.getString("downInfo")); +*/ + diff --git a/banco/app/src/main/java/br/banco/services/fund/interactor/ILoadTask.java b/banco/app/src/main/java/br/banco/services/fund/interactor/ILoadTask.java new file mode 100644 index 00000000..adf6d8f7 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/interactor/ILoadTask.java @@ -0,0 +1,15 @@ +package br.banco.services.fund.interactor; + +import android.os.Parcel; + +import java.util.ArrayList; +import java.util.List; + + +public interface ILoadTask { + + void processFinish(String output); // load + void convertFinish(List listScreen, String message); // object + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/interactor/LoadHttpFile.java b/banco/app/src/main/java/br/banco/services/fund/interactor/LoadHttpFile.java new file mode 100644 index 00000000..27796dc7 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/interactor/LoadHttpFile.java @@ -0,0 +1,61 @@ +package br.banco.services.fund.interactor; + +import android.util.Log; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +public class LoadHttpFile { + + + public String loadExternalJson(String jsonURL) throws IOException { + + // Log.d("FUND","MODEL / "+getClass().getName()+" -> " + jsonURL); + + try{ + + java.net.URL url = new URL(jsonURL); + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + + conn.setReadTimeout(10000); + conn.setConnectTimeout(15000); + conn.setRequestMethod("GET"); + conn.setDoInput(true); + conn.connect(); + + BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); + String line; + StringBuilder SB = new StringBuilder(); + + while ((line = in.readLine()) != null) { + + // Log.d("FUND", "@@ loadJSON() " + line); + + SB.append(line); + + } + + //Log.d("FUND","MODEL / loadExternalJson -> SUCCESS" ); + + in.close(); + return SB.toString(); + + }catch (Exception ex){ + Log.d("FUND","MODEL / loadExternalJson -> ERROR" +ex.getMessage() ); + return null; + } + + + + } //loadExternalJson + + + +} + + + + diff --git a/banco/app/src/main/java/br/banco/services/fund/interactor/LoadHttpFileTask.java b/banco/app/src/main/java/br/banco/services/fund/interactor/LoadHttpFileTask.java new file mode 100644 index 00000000..3f4c97cf --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/interactor/LoadHttpFileTask.java @@ -0,0 +1,73 @@ + +package br.banco.services.fund.interactor; + +import android.content.Context; +import android.os.AsyncTask; +import android.util.Log; + +public class LoadHttpFileTask extends AsyncTask { + + public ILoadTask delegate = null; + + public LoadHttpFileTask(Context context) { + + // + } + + @Override + protected void onPreExecute() { + super.onPreExecute(); + + // Log.d("FUND","MODEL / "+getClass().getName()+" / doInBackground -> START "); + } + + @Override + protected String doInBackground(String... loadValues) { + + // Log.d("FUND","doInBackground -> " + loadValues[0] ); + + String teste = "0"; + String textValues = null; + String urlServer = loadValues[0]; // ValidatorURL + + // web, local + + + try { + + LoadHttpFile load = new LoadHttpFile(); + textValues = load.loadExternalJson(urlServer); + + // Log.d("FUND","MODEL / doInBackground -> SUCCESS" ); + + + } catch (Exception e) { + Log.d("FUND","MODEL / doInBackground -> ERROR: " + e.getMessage()); + e.printStackTrace(); + } + + return textValues; + + } + + protected void onProgressUpdate(String... progress) { + //Log.d("FUND", "MODEL / doInBackground -> " + progress[0]); + } + + @Override + protected void onPostExecute(String result) { + + // Log.d("FUND", "MODEL / onPostExecute -> result=" + result); + delegate.processFinish(result); + + } + + + + + + + + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/interactor/LoadInternet.java b/banco/app/src/main/java/br/banco/services/fund/interactor/LoadInternet.java new file mode 100644 index 00000000..2fbbabae --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/interactor/LoadInternet.java @@ -0,0 +1,80 @@ +package br.banco.services.fund.interactor; + +import android.content.Context; +import android.os.AsyncTask; +import android.util.Log; + +import br.banco.services.app.utils.ConnectionChek; +import br.banco.services.app.utils.ReactAplication; + +public class LoadInternet extends AsyncTask { + + public ILoadTask delegate = null; + public int ATTEMPTS = 0; + public String STATUS = "error"; + public Context context; + public ReactAplication RX = new ReactAplication(); + + public LoadInternet(Context c) { + this.ATTEMPTS = 3; + this.context = c; + + if(context == null){ + // delegate.processFinish(STATUS); + } + } + + @Override + protected void onPreExecute() { + super.onPreExecute(); + //this.cancel(true); + // RX.onNext("Conectando..." ); + } + + @Override + protected String doInBackground(String... loadValues) { + + String textValues = null; + String urlServer = loadValues[0]; // ValidatorURL + + try { + + // temnta 3 vezes + if(ConnectionChek.isNetworkAvailable(context) == true){ + // RX.onNext("Contectado com sucesso!"); + STATUS = "success"; + }else{ + // RX.onNext("Nao foi possivel conectar "); + + for(int count = 0; count < 3; count++){ + // Thread.sleep(3000); + //RX.onNext("Tentando novamente: " + count); + ATTEMPTS = count; + + if(ConnectionChek.isNetworkAvailable(context) == true){ + STATUS = "success"; + } + }//for + } + } catch (Exception e) { + RX.onError(e); + delegate.processFinish(STATUS); + e.printStackTrace(); + + } + + return STATUS; + } + + protected void onProgressUpdate(String... progress) { + // RX.onNext("onProgressUpdate=" + progress[0]); + } + + @Override + protected void onPostExecute(String result) { + //RX.onNext("onPostExecute=" + STATUS + "->result->"+result); + delegate.processFinish(result); + + } + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/interactor/LoadJson.java b/banco/app/src/main/java/br/banco/services/fund/interactor/LoadJson.java new file mode 100644 index 00000000..528c858f --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/interactor/LoadJson.java @@ -0,0 +1,105 @@ +package br.banco.services.fund.interactor; + +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; + +import org.json.JSONObject; + +import br.banco.services.R; +import br.banco.services.app.utils.JsonConvert; +import br.banco.services.app.utils.ReactAplication; +import br.banco.services.fund.data.template.FromFund; +import br.banco.services.fund.data.template.FromScreen; + +//import org.json.JSONException; +//import org.json.JSONObject; + + +public class LoadJson extends AppCompatActivity { + + public ReactAplication RX = new ReactAplication(); + public JSONObject jsonObject; + private String TAG = "FUND"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.teste); + + Read(); + // Update(); + // Debug(); + // Test(); + + + } + + + public void Read(){ + + FromScreen fromScreen = new FromScreen(); + String jsonString = fromScreen.LOAD_DATA_DEVICE; + JsonConvert convert = new JsonConvert(); + + + // OK -------------------- converter para OBJETO + + //0 screen = OBJ + // convert.searchLevelZero(jsonString, "screen", 2000); //moreInfo + + + // -------------------- converter para OBJETO + + // 1 //downInfo = OBJ + // convert.searchLevelOne(jsonString, "moreInfo", 2000); // screen + + + // -------------------- converter para OBJETO + + // 3 //downInfo = OBJ + // convert.searchLevelTree(jsonString, "moreInfo", "month", 2000); // + + + // -------------------- converter para ARRAY + + + // 2 info, downInfo = Array + // convert.searchLevelOneArray(jsonString, "info", 2000); // moreInfo + // convert.searchLevelOneArray(jsonString, "downInfo", 2000); // moreInfo + + + // 3 //info = Array + convert.searchLevelTreeArray(jsonString, "info","name", 2000); + //convert.searchLevelTreeArray(jsonString, "downInfo","data", 2000); + + } + + public void Update(){ + + + + } + + + public void Debug(){ + + + + } + + + public void Test(){ + + + + } + + + + + + + +} + + diff --git a/banco/app/src/main/java/br/banco/services/fund/interactor/LoadScreen.java b/banco/app/src/main/java/br/banco/services/fund/interactor/LoadScreen.java new file mode 100644 index 00000000..db77a3c4 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/interactor/LoadScreen.java @@ -0,0 +1,181 @@ +package br.banco.services.fund.interactor; + +import android.content.Context; +import android.os.AsyncTask; +import android.util.Log; + +import java.util.ArrayList; +import java.util.List; + +import br.banco.services.R; +import br.banco.services.app.utils.ReactAplication; +import br.banco.services.fund.data.template.FromFund; +import br.banco.services.fund.data.template.FromScreen; +import br.banco.services.fund.domain.national.ScreenFund; +import br.banco.services.fund.domain.national.ScreenFundTemplate; + +/** + +@rules: + + CLASS BASE: Fund + CLASSE RELATORIO: ScreenFundTemplate OU ScreenFund + DEPENDE DE: FromScreen; + + + @param: String Name = screen + @param: String Data = JSON ; + @param: String Type = Text; + @param: int Size = 10; + @param: int Chars = 1000; + @param: int Bytes = null; + + + */ + +public class LoadScreen extends AsyncTask { + + public ILoadTask delegate = null; + private String STATUS = "error"; + + public Context context; + + public FromScreen screenRule; + public ScreenFundTemplate screenTemplate; + public ReactAplication RX = new ReactAplication(); + + public List listaTemplate = new ArrayList(); + public List listaExport = new ArrayList(); + + public ArrayList listScreen = new ArrayList<>(); + public ArrayList listFund = new ArrayList<>(); + public ArrayList listMoreinfo = new ArrayList<>(); + public ArrayList listInfo = new ArrayList<>(); + public ArrayList listDownInfo = new ArrayList<>(); + + public int tScreen = 0; // < - carregar de pacote + public int tFund = 0; + public int tMoreingo = 0; + public int tInfo = 0; + public int tDownInfo = 0; + + private int SHARED_PREFERENCES = 1; + private String JSON_CARREGADO = null; + + + public LoadScreen(Context c) { + + this.screenRule = new FromScreen(); + // this.screenTemplate = new ScreenFundTemplate(Object); // + + this.SHARED_PREFERENCES = 1; + this.JSON_CARREGADO = screenRule.LOAD_DATA_DEVICE; + + this.context = c; + + + if(context == null){ + + // delegate.processFinish(STATUS); + // this.cancel(true); + + } + } + + @Override + protected void onPreExecute() { + super.onPreExecute(); + //this.cancel(true); + // RX.onNext("Conectando..." ); + + } + + @Override + protected String doInBackground(String... loadValues) { + + String textValues = null; + String urlServer = loadValues[0]; + + textValues = "[ DADOS JSON AQUI - OBJETO]"; + + try { + + if(SHARED_PREFERENCES == 1){ + + + + + Log.e("FUND",JSON_CARREGADO); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + STATUS = "success"; + }else{ + + RX.onNext("Nao foi possivel carregar preferencias "); + STATUS = "error"; + } + + } catch (Exception e) { + RX.onError(e); + delegate.convertFinish(null,STATUS); + e.printStackTrace(); + + } + + return textValues; + } + + protected void onProgressUpdate(String... progress) { + // RX.onNext("onProgressUpdate=" + progress[0]); + } + + @Override + protected void onPostExecute(String result) { + RX.onNext("onPostExecute->" + STATUS + " / result->"+result); + // delegate.convertFinish(listaExport , STATUS); + + } + +} + +/** +* +* Sequencia de carregamento: +* +* FUND, CONTACT: +* View> Presenter-> Model> Screen> Rules> dbase[Json / Share / dbase] +* Rules[...] lista = new ArrayList(); + lista.add ("bla"); + List subLista = new ArrayList(); + subLista.add ("ble"); + subLista.add ("bli"); + lista.add (subLista); + for (Object o : lista) { + if (o instanceof List) { + // este é o cast "inseguro". + for (String s: (List)o) + { + System.out.print(s + ","); + } + System.out.println (); + } else { + String s = (String) o; + System.out.println ("s=" + s); + } + } + + + + } +} diff --git a/banco/app/src/main/java/br/banco/services/fund/interactor/ScreenListWriter.java b/banco/app/src/main/java/br/banco/services/fund/interactor/ScreenListWriter.java new file mode 100644 index 00000000..8e2cb2e8 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/interactor/ScreenListWriter.java @@ -0,0 +1,35 @@ +package br.banco.services.fund.interactor; + +import java.util.ArrayList; +import java.util.List; + +public class ScreenListWriter { + + + public void readItens(){ + + + List lista = new ArrayList(); + lista.add ("bla"); + List subLista = new ArrayList(); + subLista.add ("ble"); + subLista.add ("bli"); + lista.add (subLista); + for (Object o : lista) { + if (o instanceof List) { + // este é o cast "inseguro". + for (String s: (List)o) + { + System.out.print(s + ","); + } + System.out.println (); + } else { + String s = (String) o; + System.out.println ("s=" + s); + } + } + + + + } +} diff --git a/banco/app/src/main/java/br/banco/services/fund/option/FundOption.java b/banco/app/src/main/java/br/banco/services/fund/option/FundOption.java new file mode 100644 index 00000000..73b26f40 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/option/FundOption.java @@ -0,0 +1,207 @@ +package br.banco.services.fund.option; + +import android.util.Log; + +import java.util.ArrayList; + +public class FundOption { + + // SIMULACAO; + + private String genre; + private String year; + + + // SIMPLES; + + private String Title; + private String FundName; + private String WhatIs; + private String Definition; + private String RiskTitle; + private int Risk; + private String InfoTitle; + + // ARRAYS + + private ArrayList MoreInfo; + private ArrayList Info; + private ArrayList DownInfo; + + + public FundOption() { + + + } + + public FundOption(String title, String genre, String year) { + + this.Title = title; + this.genre = genre; + this.year = year; + } + + // strings + + public String getTitle() { + return Title; + } + + public void setTitle(String name) { + this.Title = name; + } + + + + public String getFundName() { + return FundName; + } + + public void setFundName(String fundName) { + FundName = fundName; + } + + public String getWhatIs() { + return WhatIs; + } + + public void setWhatIs(String whatIs) { + WhatIs = whatIs; + } + + public String getDefinition() { + return Definition; + } + + public void setDefinition(String definition) { + Definition = definition; + } + + public String getRiskTitle() { + return RiskTitle; + } + + public void setRiskTitle(String riskTitle) { + RiskTitle = riskTitle; + } + + public int getRisk() { + return Risk; + } + + public void setRisk(int risk) { + Risk = risk; + } + + public String getInfoTitle() { + return InfoTitle; + } + + public void setInfoTitle(String infoTitle) { + InfoTitle = infoTitle; + } + + //Arrays + + + public ArrayList getMoreInfo() { + return MoreInfo; + } + + public void setMoreInfo(ArrayList moreInfo) { + MoreInfo = moreInfo; + } + + public ArrayList getInfo() { + return Info; + } + + public void setInfo(ArrayList info) { + Info = info; + } + + public ArrayList getDownInfo() { + return DownInfo; + } + + public void setDownInfo(ArrayList downInfo) { + DownInfo = downInfo; + } + + + /*------------------*/ + + + + public String getYear() { + return year; + } + + public void setYear(String year) { + this.year = year; + } + + public String getGenre() { + return genre; + } + + public void setGenre(String genre) { + this.genre = genre; + } + + + // tests + + public void showArray(String TAG, String FUNCTION, ArrayList listValues){ + + Log.i(TAG, "@TAG: " + TAG + " / " + FUNCTION); + + if(listValues.size() == 9 || TAG != null) { + + Log.i(TAG, "Title = " + listValues.get(0)); + Log.i(TAG, "FundName = " + listValues.get(1)); + Log.i(TAG, "WhatIs = " + listValues.get(2)); + Log.i(TAG, "Definition = " + listValues.get(3)); + Log.i(TAG, "RiskTitle = " + listValues.get(4)); + Log.i(TAG, "Risk = " + listValues.get(5)); + Log.i(TAG, "InfoTitle = " + listValues.get(6)); + + Log.i(TAG, "moreInfo = " + listValues.get(6)); + Log.i(TAG, "info = " + listValues.get(7)); + Log.i(TAG, "downInfo = " + listValues.get(8)); + + }else{ + Log.e(TAG, "Erro: @TAG: " + TAG + " / " + FUNCTION + " lista incompleta!" ); + } + } + + + + public void showClass(String TAG, String FUNCTION, FundOption fund){ + + Log.i(TAG, "@TAG: " + TAG + " / " + FUNCTION); + + if( fund!=null && TAG != null) { + + Log.d(TAG, " fund.getTitle() = " + fund.getTitle()); + Log.d(TAG, " fund.getFundName() = " + fund.getFundName()); + Log.d(TAG, " fund.getWhatIs() = " + fund.getWhatIs()); + Log.d(TAG, " fund.getDefinition() = " + fund.getDefinition()); + Log.d(TAG, " fund.getRiskTitle() = " + fund.getRiskTitle()); + Log.d(TAG, " fund.getRisk() = " + fund.getRisk()); + Log.d(TAG, " fund.getInfoTitle() = " + fund.getInfoTitle()); + + Log.d(TAG, " fund.getMoreInfo() = " + fund.getMoreInfo()); + Log.d(TAG, " fund.getInfo() = " + fund.getInfo()); + Log.d(TAG, " fund.getDownInfo() = " + fund.getDownInfo()); + + }else{ + Log.e(TAG, "Erro: @TAG: " + TAG + " / " + FUNCTION + " objeto nulo!" ); + } + } + + + + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/option/FundOptionAdapter.java b/banco/app/src/main/java/br/banco/services/fund/option/FundOptionAdapter.java new file mode 100644 index 00000000..909511cb --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/option/FundOptionAdapter.java @@ -0,0 +1,55 @@ +package br.banco.services.fund.option; + +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import java.util.List; + +import br.banco.services.R; + +public class FundOptionAdapter extends RecyclerView.Adapter { + + private List moviesList; + + public class MyViewHolder extends RecyclerView.ViewHolder { + public TextView title, year, genre; + + public MyViewHolder(View view) { + super(view); + title = (TextView) view.findViewById(R.id.title); + genre = (TextView) view.findViewById(R.id.genre); + year = (TextView) view.findViewById(R.id.year); + } + } + + + public FundOptionAdapter(List moviesList) { + this.moviesList = moviesList; + } + + @Override + public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View itemView = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.fund_list_row, parent, false); + + return new MyViewHolder(itemView); + } + + @Override + public void onBindViewHolder(MyViewHolder holder, int position) { + + FundOption fund = moviesList.get(position); + + holder.title.setText(fund.getTitle()); + holder.genre.setText(fund.getGenre()); + holder.year.setText(fund.getYear()); + } + + @Override + public int getItemCount() { + return moviesList.size(); + } +} diff --git a/banco/app/src/main/java/br/banco/services/fund/option/FundOptionPresenter.java b/banco/app/src/main/java/br/banco/services/fund/option/FundOptionPresenter.java new file mode 100644 index 00000000..caa81e4c --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/option/FundOptionPresenter.java @@ -0,0 +1,62 @@ +package br.banco.services.fund.option; + +import android.content.Context; +import android.util.Log; + +import br.banco.services.app.alert.Alert; +import br.banco.services.app.message.IMessage; +import br.banco.services.app.message.MessageType; +import br.banco.services.fund.FundModelTemplate; + +public class FundOptionPresenter { + + private String TAG = "FUND"; + + private FundModelTemplate template; + private IFundOption.ModelImpl modelImpl; + private IFundOption.ViewImpl viewImpl; + private Alert alert; + + + FundOptionPresenter(IFundOption.ViewImpl views) { + + template = new FundModelTemplate(); + this.viewImpl = views; + this.alert = new Alert(); + + } + + //@Override + public Context getContext() { + return (Context) viewImpl; + } + + + public void drawOptionList(){ + + String[][][] list; + list = template.getListMoreInfoTemplate(); + + if(list != null) { + + //viewImpl.drawOptionListView(); + viewImpl.updateOptionListView(template); + + }else{ + + } + + } + + + public void loadAlert(int msgCode, Context context){ + + msgCode = (msgCode >= 0 && msgCode <= 5 ) ? msgCode : 0; + viewImpl.updateAlertView(msgCode, context); + + } + + + + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/option/FundOptionTouchListener.java b/banco/app/src/main/java/br/banco/services/fund/option/FundOptionTouchListener.java new file mode 100644 index 00000000..29fe6b1c --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/option/FundOptionTouchListener.java @@ -0,0 +1,57 @@ +package br.banco.services.fund.option; + +import android.content.Context; +import android.support.v7.widget.RecyclerView; +import android.view.GestureDetector; +import android.view.MotionEvent; +import android.view.View; + +public class FundOptionTouchListener implements RecyclerView.OnItemTouchListener { + + private GestureDetector gestureDetector; + private ClickListener clickListener; + + public FundOptionTouchListener(Context context, final RecyclerView recyclerView, final ClickListener clickListener) { + this.clickListener = clickListener; + gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { + @Override + public boolean onSingleTapUp(MotionEvent e) { + return true; + } + + @Override + public void onLongPress(MotionEvent e) { + + View child = recyclerView.findChildViewUnder(e.getX(), e.getY()); + if (child != null && clickListener != null) { + clickListener.onLongClick(child, recyclerView.getChildPosition(child)); + } + } + }); + } + + @Override + public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { + + View child = rv.findChildViewUnder(e.getX(), e.getY()); + if (child != null && clickListener != null && gestureDetector.onTouchEvent(e)) { + clickListener.onClick(child, rv.getChildPosition(child)); + } + return false; + } + + @Override + public void onTouchEvent(RecyclerView rv, MotionEvent e) { + } + + @Override + public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { + + } + + public interface ClickListener { + void onClick(View view, int position); + + void onLongClick(View view, int position); + } +} \ No newline at end of file diff --git a/banco/app/src/main/java/br/banco/services/fund/option/FundOptionView.java b/banco/app/src/main/java/br/banco/services/fund/option/FundOptionView.java new file mode 100644 index 00000000..89af9133 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/option/FundOptionView.java @@ -0,0 +1,297 @@ +package br.banco.services.fund.option; + +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.os.Handler; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.DefaultItemAnimator; +import android.support.v7.widget.DividerItemDecoration; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.widget.Button; +import android.widget.ProgressBar; +import android.widget.Toast; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import br.banco.services.R; +import br.banco.services.app.utils.ConnectionChek; +import br.banco.services.contact.ContactView; +import br.banco.services.fund.FundModelTemplate; + +public class FundOptionView extends AppCompatActivity implements + IFundOption.ViewImpl, + View.OnClickListener { + + private final String TAG ="FUND"; + private FundOptionPresenter presenter; + private int messageCode = 4; // Error + + private List fundList = new ArrayList<>(); + private RecyclerView recyclerView; + private FundOptionAdapter mAdapter; + private FundModelTemplate template2; + + private ConnectionChek internet; + //private ProgressBar progressBar; + + //private static IFundDetailption.ViewImpl viewImpl; + private static IFundOption.PresenterImpl presenterImpl; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_fund_list2); + + drawOptionListView(); + drawNavigation(); + presenter = new FundOptionPresenter (this); + + // Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + // setSupportActionBar(toolbar); + + + if(checkInternet()){ + presenter.drawOptionList(); + + }else{ + int msgCode = 2; + presenter.loadAlert( msgCode, getApplicationContext()); + } + + + } + + @Override + public void onResume() { + super.onResume(); + + if(checkOptionListView() < 1){ + + Log.d(TAG, "VIEW / "+getClass().getName()+" / onResume -> checkOptionListView = 0" ); + + if(checkInternet()){ + + presenter.drawOptionList(); + Log.d(TAG, "VIEW / "+getClass().getName()+" / onResume -> drawOptionList" ); + + if(checkOptionListView() < 1){ + + int msgCode = 4; + presenter.loadAlert( msgCode, getApplicationContext()); + } + + }else{ + int msgCode = 2; + presenter.loadAlert( msgCode, getApplicationContext()); + } + + } + } + + 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; + } + + } + + public void drawOptionListView(){ + + + recyclerView = (RecyclerView) findViewById(R.id.recycler_view); + mAdapter = new FundOptionAdapter(fundList); + recyclerView.setHasFixedSize(true); + + // vertical / match_parent + RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext()); + + // horizontal // wrap_content + // RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext(), LinearLayoutManager.HORIZONTAL, false); + + recyclerView.setLayoutManager(mLayoutManager); + recyclerView.addItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.VERTICAL)); + recyclerView.setItemAnimator(new DefaultItemAnimator()); + recyclerView.setAdapter(mAdapter); + + // click + recyclerView.addOnItemTouchListener(new FundOptionTouchListener(getApplicationContext(), + recyclerView, new FundOptionTouchListener.ClickListener() { + @Override + public void onClick(View view, int position) { + + FundOption fund = fundList.get(position); + Intent intent = new Intent(); + String FDFundoTitulo = fund.getTitle() ; + + + //br.banco.services.app.alert.AlertView.class + intent = new Intent(getApplicationContext(), + br.banco.services.fund.detail.DetailView.class ); + intent.putExtra("BD_FUNDO_TITULO", "" + FDFundoTitulo); + + + startActivity(intent); + overridePendingTransition(R.anim.an_entrar_esquerda, R.anim.an_sair_esquerda); + + // finish(); + + // Toast.makeText(getApplicationContext(), fund.getTitle() + " foi clicado!", Toast.LENGTH_SHORT).show(); + } + + @Override + public void onLongClick(View view, int position) { + + Intent intent2 = new Intent(); + + //br.banco.services.app.alert.AlertView.class + intent2 = new Intent(getApplicationContext(), + br.banco.services.contact.ContactView.class ); + //intent.putExtra("messageCode", messageCode); + startActivity(intent2); + overridePendingTransition(R.anim.an_sair, R.anim.an_entrar); + + } + })); + + Log.d(TAG," / drawOptionListView -> SUCESS " ); + } + + public void updateOptionListView(FundModelTemplate template) { + + FundOption fund; + String[][][] list = null; + + list = template.getListMoreInfoTemplate(); + + if(list !=null && list.length > 0) { + + for (int count = 0; count < list.length; count++) { + + template.setNameLabel(count); + template.setMonthLabel(count); + template.setTimeLabel(count); + + template.setName(count); + template.setMonth(count); + template.setTime(count); + + fund = new FundOption( + "" + template.getName(), + "" + template.getMonthLabel() + ": " + template.getMonth(), + "" + template.getTimeLabel() + ": " + template.getTime()); + + fundList.add(fund); + + Log.d(TAG, "VIEW / updateOptionListView -> SUCESS "); + } + + + mAdapter.notifyDataSetChanged(); + + }else{ + + Log.d(TAG, "VIEW / "+getClass().getName()+" / updateOptionListView -> ERROR" ); + } + + + } + + public int checkOptionListView(){ + + int contItens = 0; + if (recyclerView.getAdapter() != null) { + contItens = recyclerView.getAdapter().getItemCount(); + } + return contItens; + } + + public void updateAlertView( int msgCode, Context context){ + + Handler handler; + messageCode = msgCode; + // delay + handler = new Handler(); + handler.postDelayed(new Runnable() { + @Override + public void run() { + + Intent intent; + intent = new Intent(getApplicationContext(), + br.banco.services.app.alert.AlertView.class ); + intent.putExtra("messageCode", messageCode); + startActivity(intent); + + overridePendingTransition(R.anim.an_sair, R.anim.an_entrar); + // finish(); + + } + }, 100); + + Log.d(TAG," / updateAlertView -> ERROR -> messageCode = " + messageCode); + + } + + @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_sair, R.anim.an_entrar); + return false; + } + return super.onKeyDown(keyCode, event); + } + + @Override + public void onClick(View view) { + + Intent IT; + Context context = getApplicationContext(); + + Button BTAction1 = (Button) findViewById(R.id.btAction1); + Button BTAction2 = (Button) findViewById(R.id.btAction2); + BTAction1.setOnClickListener(this); + BTAction2.setOnClickListener(this); + + switch (view.getId()) { + + /* case R.id.btAction1: + IT = new Intent(this, br.banco.services.fund.option.FundOptionView.class); + startActivity(IT); + overridePendingTransition(R.anim.an_entrar_esquerda,R.anim.an_sair_esquerda); + break; + */ + case R.id.btAction2: + IT = new Intent(this, br.banco.services.contact.ContactView.class); + startActivity(IT); + overridePendingTransition(R.anim.an_entrar_esquerda,R.anim.an_sair_esquerda); + break; + + } + + } + + public void drawNavigation(){ + Button BTAction1 = (Button) findViewById(R.id.btAction1); + Button BTAction2 = (Button) findViewById(R.id.btAction2); + BTAction1.setOnClickListener(this); + BTAction2.setOnClickListener(this); + } + +} diff --git a/banco/app/src/main/java/br/banco/services/fund/option/FundOptionViewTemplate.java b/banco/app/src/main/java/br/banco/services/fund/option/FundOptionViewTemplate.java new file mode 100644 index 00000000..eb85443d --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/option/FundOptionViewTemplate.java @@ -0,0 +1,109 @@ +package br.banco.services.fund.option; + +import android.content.Context; +import android.content.res.Resources; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Rect; +import android.graphics.drawable.Drawable; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.util.TypedValue; +import android.view.View; + +public class FundOptionViewTemplate extends RecyclerView.ItemDecoration { + + private static final int[] ATTRS = new int[]{ + android.R.attr.listDivider + }; + + public static final int HORIZONTAL_LIST = LinearLayoutManager.HORIZONTAL; + + public static final int VERTICAL_LIST = LinearLayoutManager.VERTICAL; + + private Drawable mDivider; + private int mOrientation; + private Context context; + private int margin; + + public FundOptionViewTemplate(Context context, int orientation, int margin) { + this.context = context; + this.margin = margin; + final TypedArray a = context.obtainStyledAttributes(ATTRS); + mDivider = a.getDrawable(0); + a.recycle(); + setOrientation(orientation); + } + + public void setOrientation(int orientation) { + if (orientation != HORIZONTAL_LIST && orientation != VERTICAL_LIST) { + throw new IllegalArgumentException("invalid orientation"); + } + mOrientation = orientation; + } + + @Override + public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) { + if (mOrientation == VERTICAL_LIST) { + drawVertical(c, parent); + } else { + drawHorizontal(c, parent); + } + } + + public void drawVertical(Canvas c, RecyclerView parent) { + final int left = parent.getPaddingLeft(); + final int right = parent.getWidth() - parent.getPaddingRight(); + + final int childCount = parent.getChildCount(); + + for (int i = 0; i < childCount; i++) { + + final View child = parent.getChildAt(i); + final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child + .getLayoutParams(); + final int top = child.getBottom() + params.bottomMargin; + final int bottom = top + mDivider.getIntrinsicHeight(); + mDivider.setBounds(left + dpToPx(margin), top, right - dpToPx(margin), bottom); + mDivider.draw(c); + + } + + } + + public void drawHorizontal(Canvas c, RecyclerView parent) { + + final int top = parent.getPaddingTop(); + final int bottom = parent.getHeight() - parent.getPaddingBottom(); + + final int childCount = parent.getChildCount(); + + for (int i = 0; i < childCount; i++) { + + final View child = parent.getChildAt(i); + final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child + .getLayoutParams(); + + final int left = child.getRight() + params.rightMargin; + final int right = left + mDivider.getIntrinsicHeight(); + + mDivider.setBounds(left, top + dpToPx(margin), right, bottom - dpToPx(margin)); + mDivider.draw(c); + } + + } + + @Override + public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { + if (mOrientation == VERTICAL_LIST) { + outRect.set(0, 0, 0, mDivider.getIntrinsicHeight()); + } else { + outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0); + } + } + + private int dpToPx(int dp) { + Resources r = context.getResources(); + return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics())); + } +} \ No newline at end of file diff --git a/banco/app/src/main/java/br/banco/services/fund/option/IFundOption.java b/banco/app/src/main/java/br/banco/services/fund/option/IFundOption.java new file mode 100644 index 00000000..9c4a5449 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/fund/option/IFundOption.java @@ -0,0 +1,33 @@ +package br.banco.services.fund.option; + +import android.content.Context; + +import br.banco.services.fund.FundModelTemplate; + +public interface IFundOption { + + + interface PresenterImpl{ + + void loadAlert(int msgCode, Context context); + // void checkOptionList(); + //void checkOptionList(); + } + interface ModelImpl{ + + // void saveOptionListModel(); + //void loadOptionListModel(); + } + interface ViewImpl{ + + boolean checkInternet(); + void drawOptionListView(); + void updateOptionListView(FundModelTemplate fund); + + void updateAlertView(int msgCode, Context context); + } + + + + +} diff --git a/banco/app/src/main/java/br/banco/services/splash/Splash.java b/banco/app/src/main/java/br/banco/services/splash/Splash.java new file mode 100644 index 00000000..44049ac8 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/splash/Splash.java @@ -0,0 +1,55 @@ +package br.banco.services.splash; + + +public class Splash { + + + 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/banco/app/src/main/java/br/banco/services/splash/SplashModel.java b/banco/app/src/main/java/br/banco/services/splash/SplashModel.java new file mode 100644 index 00000000..a7c51630 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/splash/SplashModel.java @@ -0,0 +1,15 @@ +package br.banco.services.splash; + +// area, titulo, mensagem, botao texto, botao estilo + +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; + +import br.banco.services.R; + +public class SplashModel { + + + + +} diff --git a/banco/app/src/main/java/br/banco/services/splash/SplashPresenter.java b/banco/app/src/main/java/br/banco/services/splash/SplashPresenter.java new file mode 100644 index 00000000..bc8533db --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/splash/SplashPresenter.java @@ -0,0 +1,38 @@ +package br.banco.services.splash; + +import android.content.Context; + +import br.banco.services.app.message.IMessage; +import br.banco.services.app.message.MessageType; + + +public class SplashPresenter { + + private Splash splash; + private View view; + + public SplashPresenter(View view) { + this.splash = new Splash(); + 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.updateSplashView(alertValues); + } + + + public interface View{ + + void drawSplashView(); + void updateSplashView(String alertValues[]); + + } + +} diff --git a/banco/app/src/main/java/br/banco/services/splash/SplashView.java b/banco/app/src/main/java/br/banco/services/splash/SplashView.java new file mode 100644 index 00000000..9022c3bc --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/splash/SplashView.java @@ -0,0 +1,96 @@ + /* + + recebe + carrega + mostra = mensagem + @FAZER: onResume() checar conexao + abrir home + */ + +package br.banco.services.splash; + + import android.content.Intent; + import android.os.Bundle; + import android.os.Handler; + import android.support.v7.app.AppCompatActivity; + import android.util.Log; + import android.widget.TextView; + + import br.banco.services.R; + import br.banco.services.app.utils.ConnectionChek; + + public class SplashView extends AppCompatActivity implements SplashPresenter.View { + + private String TAG = "SPLASH"; + private SplashPresenter presenter; + + private int messageStart = 0; // Load + private int messageCode = 4; // Error + + private ConnectionChek internet; + private Handler handler; + + private Intent intent; + public TextView mTextView; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + internet = new ConnectionChek(); + + if(internet.isNetworkAvailable(getApplicationContext()) == true){ + messageCode = 3; // Sucess + }else{ + messageCode = 4; // Error + } + + setContentView(R.layout.activity_splash); + + drawSplashView(); + mTextView = (TextView) findViewById(R.id.tvStartText); + + presenter = new SplashPresenter(this); + // Log.d(TAG, " onCreate // messageCode = " + messageCode) ; + + } + + @Override + public void onResume() { + super.onResume(); + presenter.loadAlertView(messageStart, getApplicationContext()); + Log.d(TAG, "VIEW / "+getClass().getName()+" / onResume -> ALERT " ); + + } + + @Override + public void updateSplashView(String[] alertValues) { + + mTextView.setText(alertValues[2] ); + + // delay + handler = new Handler(); + handler.postDelayed(new Runnable() { + @Override + public void run() { + //br.banco.services.app.alert.AlertView.class + intent = new Intent(getApplicationContext(), + br.banco.services.fund.option.FundOptionView.class ); + intent.putExtra("messageCode", messageCode); + startActivity(intent); + finish(); + + } + }, 3000); + + Log.d(TAG, "VIEW / "+getClass().getName()+" / updateSplashView -> AlertView / " + messageCode ); + + } + + @Override + public void drawSplashView(){ + + mTextView = (TextView) findViewById(R.id.DT_fd_fundName); + } + + + + + } diff --git a/banco/app/src/main/java/br/banco/services/splash/task/LoadInfo.java b/banco/app/src/main/java/br/banco/services/splash/task/LoadInfo.java new file mode 100644 index 00000000..d916f518 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/splash/task/LoadInfo.java @@ -0,0 +1,57 @@ +package br.banco.services.splash.task; + // executar tarefa caso o app esteja diferente +import android.app.Activity; +import android.os.Bundle; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.TextView; + + +import br.banco.services.R; + +public class LoadInfo extends Activity { + + public TextView textView; + LoadInfoTask asyncTask; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + textView = (TextView) findViewById(R.id.mTextView); + + textView.setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + + } + }); + } + + LoadInfoTask.OnAsyncResult asynResult = new LoadInfoTask.OnAsyncResult() { + + @Override + public void onResultSuccess(final int resultCode, final String message) { + + runOnUiThread(new Runnable() { + public void run() { + textView.setText("Code : " + resultCode + "\nMessage : " + message); + } + }); + } + + @Override + public void onResultFail(final int resultCode, final String errorMessage) { + + runOnUiThread(new Runnable() { + public void run() { + textView.setText("Code : " + resultCode + "\nMessage : " + errorMessage); + } + }); + + } + }; + +} diff --git a/banco/app/src/main/java/br/banco/services/splash/task/LoadInfoTask.java b/banco/app/src/main/java/br/banco/services/splash/task/LoadInfoTask.java new file mode 100644 index 00000000..3fde2568 --- /dev/null +++ b/banco/app/src/main/java/br/banco/services/splash/task/LoadInfoTask.java @@ -0,0 +1,85 @@ +package br.banco.services.splash.task; + + +import android.os.AsyncTask; +import android.os.Handler; +import android.util.Log; + +public class LoadInfoTask extends AsyncTask { + + public OnAsyncResult onAsyncResult; + + public void setOnResultListener(OnAsyncResult onAsyncResult) { + if (onAsyncResult != null) { + this.onAsyncResult = onAsyncResult; + + } + } + + @Override + protected Void doInBackground(Void... params) { + + + + if (onAsyncResult != null) { + + + if (2==2) { + onAsyncResult.onResultSuccess(0, "SUCESSO"); + } else { + onAsyncResult.onResultFail(1, "ERRO"); + } + } + + return null; + } + + protected void onPostExecute(Integer results) { + + try { + + + Handler handler = new Handler(); + handler.postDelayed(new Runnable() { + @Override + public void run() { + + Log.d("FUND","SUCESSO"); + + } + }, 5000); + + } catch (Exception e) { + Log.d("FUND","ERRO"); + e.printStackTrace(); + } + + } + + + + + public interface OnAsyncResult { + + void onResultSuccess(int resultCode, String message); + + void onResultFail(int resultCode, String errorMessage); + } + +} + + +/* + + + Handler handler = new Handler(); + handler.postDelayed(new Runnable() { + @Override + public void run() { + + + + } + }, 3000); + + */ \ No newline at end of file diff --git a/banco/app/src/main/res/anim/an_descer.xml b/banco/app/src/main/res/anim/an_descer.xml new file mode 100644 index 00000000..50848daf --- /dev/null +++ b/banco/app/src/main/res/anim/an_descer.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/anim/an_entrar.xml b/banco/app/src/main/res/anim/an_entrar.xml new file mode 100644 index 00000000..1406e4c2 --- /dev/null +++ b/banco/app/src/main/res/anim/an_entrar.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/anim/an_entrar_esquerda.xml b/banco/app/src/main/res/anim/an_entrar_esquerda.xml new file mode 100644 index 00000000..c357981e --- /dev/null +++ b/banco/app/src/main/res/anim/an_entrar_esquerda.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/anim/an_fade_in.xml b/banco/app/src/main/res/anim/an_fade_in.xml new file mode 100644 index 00000000..a02b47c3 --- /dev/null +++ b/banco/app/src/main/res/anim/an_fade_in.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/anim/an_fade_out.xml b/banco/app/src/main/res/anim/an_fade_out.xml new file mode 100644 index 00000000..4a91d2dc --- /dev/null +++ b/banco/app/src/main/res/anim/an_fade_out.xml @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/anim/an_feader.xml b/banco/app/src/main/res/anim/an_feader.xml new file mode 100644 index 00000000..d36e5909 --- /dev/null +++ b/banco/app/src/main/res/anim/an_feader.xml @@ -0,0 +1,16 @@ + + + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/anim/an_loading.xml b/banco/app/src/main/res/anim/an_loading.xml new file mode 100644 index 00000000..2fd72282 --- /dev/null +++ b/banco/app/src/main/res/anim/an_loading.xml @@ -0,0 +1,16 @@ + + + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/anim/an_sair.xml b/banco/app/src/main/res/anim/an_sair.xml new file mode 100644 index 00000000..0cb64c7d --- /dev/null +++ b/banco/app/src/main/res/anim/an_sair.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/anim/an_sair_esquerda.xml b/banco/app/src/main/res/anim/an_sair_esquerda.xml new file mode 100644 index 00000000..432a978d --- /dev/null +++ b/banco/app/src/main/res/anim/an_sair_esquerda.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/banco/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..1f6bb290 --- /dev/null +++ b/banco/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/banco/app/src/main/res/drawable-v24/shape_button_dark.xml b/banco/app/src/main/res/drawable-v24/shape_button_dark.xml new file mode 100644 index 00000000..fcecac86 --- /dev/null +++ b/banco/app/src/main/res/drawable-v24/shape_button_dark.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable-v24/shape_button_light.xml b/banco/app/src/main/res/drawable-v24/shape_button_light.xml new file mode 100644 index 00000000..954d30c2 --- /dev/null +++ b/banco/app/src/main/res/drawable-v24/shape_button_light.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable-v24/shape_button_primary.xml b/banco/app/src/main/res/drawable-v24/shape_button_primary.xml new file mode 100644 index 00000000..62e24714 --- /dev/null +++ b/banco/app/src/main/res/drawable-v24/shape_button_primary.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable-v24/shape_chart_bar_fund.xml b/banco/app/src/main/res/drawable-v24/shape_chart_bar_fund.xml new file mode 100644 index 00000000..0406536a --- /dev/null +++ b/banco/app/src/main/res/drawable-v24/shape_chart_bar_fund.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/banco/app/src/main/res/drawable-v24/shape_circle.xml b/banco/app/src/main/res/drawable-v24/shape_circle.xml new file mode 100644 index 00000000..28a6c098 --- /dev/null +++ b/banco/app/src/main/res/drawable-v24/shape_circle.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable-v24/shape_circle_dark.xml b/banco/app/src/main/res/drawable-v24/shape_circle_dark.xml new file mode 100644 index 00000000..094f130d --- /dev/null +++ b/banco/app/src/main/res/drawable-v24/shape_circle_dark.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable-v24/shape_circle_default.xml b/banco/app/src/main/res/drawable-v24/shape_circle_default.xml new file mode 100644 index 00000000..08bc1e3a --- /dev/null +++ b/banco/app/src/main/res/drawable-v24/shape_circle_default.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable-v24/shape_circle_light.xml b/banco/app/src/main/res/drawable-v24/shape_circle_light.xml new file mode 100644 index 00000000..7db3ec38 --- /dev/null +++ b/banco/app/src/main/res/drawable-v24/shape_circle_light.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable-v24/shape_selector.xml b/banco/app/src/main/res/drawable-v24/shape_selector.xml new file mode 100644 index 00000000..75b8edb8 --- /dev/null +++ b/banco/app/src/main/res/drawable-v24/shape_selector.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/banco/app/src/main/res/drawable-v24/shape_selector_button.xml b/banco/app/src/main/res/drawable-v24/shape_selector_button.xml new file mode 100644 index 00000000..1d58f4b9 --- /dev/null +++ b/banco/app/src/main/res/drawable-v24/shape_selector_button.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/banco/app/src/main/res/drawable-v24/shape_selector_button_circle.xml b/banco/app/src/main/res/drawable-v24/shape_selector_button_circle.xml new file mode 100644 index 00000000..e6d3db16 --- /dev/null +++ b/banco/app/src/main/res/drawable-v24/shape_selector_button_circle.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/banco/app/src/main/res/drawable-v24/shape_selector_list.xml b/banco/app/src/main/res/drawable-v24/shape_selector_list.xml new file mode 100644 index 00000000..b09fa296 --- /dev/null +++ b/banco/app/src/main/res/drawable-v24/shape_selector_list.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/banco/app/src/main/res/drawable-v24/shape_square.xml b/banco/app/src/main/res/drawable-v24/shape_square.xml new file mode 100644 index 00000000..a161cd60 --- /dev/null +++ b/banco/app/src/main/res/drawable-v24/shape_square.xml @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable-v24/shape_square_dark.xml b/banco/app/src/main/res/drawable-v24/shape_square_dark.xml new file mode 100644 index 00000000..7972bde4 --- /dev/null +++ b/banco/app/src/main/res/drawable-v24/shape_square_dark.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable-v24/shape_square_default.xml b/banco/app/src/main/res/drawable-v24/shape_square_default.xml new file mode 100644 index 00000000..85d86955 --- /dev/null +++ b/banco/app/src/main/res/drawable-v24/shape_square_default.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable-v24/shape_square_light.xml b/banco/app/src/main/res/drawable-v24/shape_square_light.xml new file mode 100644 index 00000000..e9b71e87 --- /dev/null +++ b/banco/app/src/main/res/drawable-v24/shape_square_light.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable-v24/shape_square_primary.xml b/banco/app/src/main/res/drawable-v24/shape_square_primary.xml new file mode 100644 index 00000000..ae72c446 --- /dev/null +++ b/banco/app/src/main/res/drawable-v24/shape_square_primary.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable/ic_launcher_background.xml b/banco/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..0d025f9b --- /dev/null +++ b/banco/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/banco/app/src/main/res/drawable/ic_launcher_foreground.xml b/banco/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 00000000..1f6bb290 --- /dev/null +++ b/banco/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/banco/app/src/main/res/drawable/ico_arrow_down.png b/banco/app/src/main/res/drawable/ico_arrow_down.png new file mode 100644 index 00000000..c6816aa4 Binary files /dev/null and b/banco/app/src/main/res/drawable/ico_arrow_down.png differ diff --git a/banco/app/src/main/res/drawable/ico_download.png b/banco/app/src/main/res/drawable/ico_download.png new file mode 100644 index 00000000..f16f38ba Binary files /dev/null and b/banco/app/src/main/res/drawable/ico_download.png differ diff --git a/banco/app/src/main/res/drawable/shape_button_dark.xml b/banco/app/src/main/res/drawable/shape_button_dark.xml new file mode 100644 index 00000000..fcecac86 --- /dev/null +++ b/banco/app/src/main/res/drawable/shape_button_dark.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable/shape_button_light.xml b/banco/app/src/main/res/drawable/shape_button_light.xml new file mode 100644 index 00000000..954d30c2 --- /dev/null +++ b/banco/app/src/main/res/drawable/shape_button_light.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable/shape_button_primary.xml b/banco/app/src/main/res/drawable/shape_button_primary.xml new file mode 100644 index 00000000..62e24714 --- /dev/null +++ b/banco/app/src/main/res/drawable/shape_button_primary.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable/shape_chart_bar_fund.xml b/banco/app/src/main/res/drawable/shape_chart_bar_fund.xml new file mode 100644 index 00000000..0406536a --- /dev/null +++ b/banco/app/src/main/res/drawable/shape_chart_bar_fund.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/banco/app/src/main/res/drawable/shape_circle.xml b/banco/app/src/main/res/drawable/shape_circle.xml new file mode 100644 index 00000000..28a6c098 --- /dev/null +++ b/banco/app/src/main/res/drawable/shape_circle.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable/shape_circle_dark.xml b/banco/app/src/main/res/drawable/shape_circle_dark.xml new file mode 100644 index 00000000..094f130d --- /dev/null +++ b/banco/app/src/main/res/drawable/shape_circle_dark.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable/shape_circle_default.xml b/banco/app/src/main/res/drawable/shape_circle_default.xml new file mode 100644 index 00000000..08bc1e3a --- /dev/null +++ b/banco/app/src/main/res/drawable/shape_circle_default.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable/shape_circle_light.xml b/banco/app/src/main/res/drawable/shape_circle_light.xml new file mode 100644 index 00000000..7db3ec38 --- /dev/null +++ b/banco/app/src/main/res/drawable/shape_circle_light.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable/shape_selector.xml b/banco/app/src/main/res/drawable/shape_selector.xml new file mode 100644 index 00000000..75b8edb8 --- /dev/null +++ b/banco/app/src/main/res/drawable/shape_selector.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/banco/app/src/main/res/drawable/shape_selector_button.xml b/banco/app/src/main/res/drawable/shape_selector_button.xml new file mode 100644 index 00000000..1d58f4b9 --- /dev/null +++ b/banco/app/src/main/res/drawable/shape_selector_button.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/banco/app/src/main/res/drawable/shape_selector_button_circle.xml b/banco/app/src/main/res/drawable/shape_selector_button_circle.xml new file mode 100644 index 00000000..e6d3db16 --- /dev/null +++ b/banco/app/src/main/res/drawable/shape_selector_button_circle.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/banco/app/src/main/res/drawable/shape_selector_list.xml b/banco/app/src/main/res/drawable/shape_selector_list.xml new file mode 100644 index 00000000..b09fa296 --- /dev/null +++ b/banco/app/src/main/res/drawable/shape_selector_list.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/banco/app/src/main/res/drawable/shape_square.xml b/banco/app/src/main/res/drawable/shape_square.xml new file mode 100644 index 00000000..a161cd60 --- /dev/null +++ b/banco/app/src/main/res/drawable/shape_square.xml @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable/shape_square_dark.xml b/banco/app/src/main/res/drawable/shape_square_dark.xml new file mode 100644 index 00000000..7972bde4 --- /dev/null +++ b/banco/app/src/main/res/drawable/shape_square_dark.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable/shape_square_default.xml b/banco/app/src/main/res/drawable/shape_square_default.xml new file mode 100644 index 00000000..85d86955 --- /dev/null +++ b/banco/app/src/main/res/drawable/shape_square_default.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable/shape_square_light.xml b/banco/app/src/main/res/drawable/shape_square_light.xml new file mode 100644 index 00000000..e9b71e87 --- /dev/null +++ b/banco/app/src/main/res/drawable/shape_square_light.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/drawable/shape_square_primary.xml b/banco/app/src/main/res/drawable/shape_square_primary.xml new file mode 100644 index 00000000..ae72c446 --- /dev/null +++ b/banco/app/src/main/res/drawable/shape_square_primary.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/banco/app/src/main/res/font/dblack.otf b/banco/app/src/main/res/font/dblack.otf new file mode 100644 index 00000000..2092a7bb Binary files /dev/null and b/banco/app/src/main/res/font/dblack.otf differ diff --git a/banco/app/src/main/res/font/dbold.otf b/banco/app/src/main/res/font/dbold.otf new file mode 100644 index 00000000..7c839536 Binary files /dev/null and b/banco/app/src/main/res/font/dbold.otf differ diff --git a/banco/app/src/main/res/font/dlight.otf b/banco/app/src/main/res/font/dlight.otf new file mode 100644 index 00000000..8a7f085a Binary files /dev/null and b/banco/app/src/main/res/font/dlight.otf differ diff --git a/banco/app/src/main/res/font/dmedium.otf b/banco/app/src/main/res/font/dmedium.otf new file mode 100644 index 00000000..b4608d06 Binary files /dev/null and b/banco/app/src/main/res/font/dmedium.otf differ diff --git a/banco/app/src/main/res/font/dregular.otf b/banco/app/src/main/res/font/dregular.otf new file mode 100644 index 00000000..84d57abb Binary files /dev/null and b/banco/app/src/main/res/font/dregular.otf differ diff --git a/banco/app/src/main/res/layout/activity_alerts.xml b/banco/app/src/main/res/layout/activity_alerts.xml new file mode 100644 index 00000000..fa64b8a2 --- /dev/null +++ b/banco/app/src/main/res/layout/activity_alerts.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + +