version estable finales 2018
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="APPVENTAS" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="java-gradle" name="Java-Gradle">
|
||||
<configuration>
|
||||
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
|
||||
<option name="BUILDABLE" value="false" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="android" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="java-gradle" name="Java-Gradle">
|
||||
<configuration>
|
||||
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
|
||||
<option name="BUILDABLE" value="false" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="kotlin-language" name="Kotlin">
|
||||
<configuration version="1">
|
||||
<option name="compilerInfo">
|
||||
<KotlinCompilerInfo>
|
||||
<option name="compilerSettings">
|
||||
<CompilerSettings />
|
||||
</option>
|
||||
<option name="k2jsCompilerArguments">
|
||||
<K2JSCompilerArguments />
|
||||
</option>
|
||||
<option name="k2jvmCompilerArguments">
|
||||
<K2JVMCompilerArguments />
|
||||
</option>
|
||||
<option name="_commonCompilerArguments">
|
||||
<DummyImpl>
|
||||
<option name="languageVersion" value="1.0" />
|
||||
<option name="apiVersion" value="1.0" />
|
||||
<option name="pluginClasspaths">
|
||||
<array />
|
||||
</option>
|
||||
<option name="coroutinesWarn" value="true" />
|
||||
<option name="pluginOptions">
|
||||
<array />
|
||||
</option>
|
||||
</DummyImpl>
|
||||
</option>
|
||||
</KotlinCompilerInfo>
|
||||
</option>
|
||||
<option name="useProjectSettings" value="false" />
|
||||
<option name="versionInfo">
|
||||
<KotlinVersionInfo>
|
||||
<option name="apiLevel" value="1.0" />
|
||||
<option name="languageLevel" value="1.0" />
|
||||
<option name="targetPlatformName" value="JVM 1.8" />
|
||||
</KotlinVersionInfo>
|
||||
</option>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1 @@
|
|||
/build
|
|
@ -0,0 +1,151 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":baselibrary" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":baselibrary" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<afterSyncTasks>
|
||||
<task>generateDebugSources</task>
|
||||
</afterSyncTasks>
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||
<option name="PROJECT_TYPE" value="1" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/compileDebugUnitTestJavaWithJavac/classes" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/not_namespaced_r_class_sources/debug/generateDebugRFile/out" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/not_namespaced_r_class_sources/debugAndroidTest/processDebugAndroidTestResources/r" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/aapt_friendly_merged_manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotation_processor_list" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations_typedef_file" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations_zip" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/intermediate-jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/library_and_local_jars_jni" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/library_assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint_jar" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/packaged-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/packaged_res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/public_res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shader_assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Gradle: androidx.slidingpanelayout:slidingpanelayout-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata-2.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.multidex:multidex-2.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-runtime-2.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.drawerlayout:drawerlayout-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.code.gson:gson:2.2.4@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata-core-2.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.core:core-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.cardview:cardview-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.appcompat:appcompat-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.versionedparcelable:versionedparcelable-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.picasso:picasso:2.5.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-utils-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.fragment:fragment-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-common:2.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.swiperefreshlayout:swiperefreshlayout-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-viewmodel-2.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.coordinatorlayout:coordinatorlayout-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.documentfile:documentfile-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.arch.core:core-common:2.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.viewpager:viewpager-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.arch.core:core-runtime-2.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-ui-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.annotation:annotation:1.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.interpolator:interpolator-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable-animated-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.loader:loader-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.customview:customview-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.localbroadcastmanager:localbroadcastmanager-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.asynclayoutinflater:asynclayoutinflater-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.cursoradapter:cursoradapter-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.print:print-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.collection:collection:1.0.0@jar" level="project" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,33 @@
|
|||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 26
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
compileOptions {
|
||||
}
|
||||
buildToolsVersion '28.0.3'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'com.android.support:appcompat-v7:26.1.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.0.0'
|
||||
implementation 'com.google.code.gson:gson:2.2.4'
|
||||
implementation 'com.squareup.picasso:picasso:2.5.0'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.multidex:multidex:2.0.0'
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in /home/nelo/adt-bundle-linux-x86_64-20140702/sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# 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 *;
|
||||
#}
|
|
@ -0,0 +1,13 @@
|
|||
package com.nelosan.baselibrary;
|
||||
|
||||
import android.app.Application;
|
||||
import android.test.ApplicationTestCase;
|
||||
|
||||
/**
|
||||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
||||
*/
|
||||
public class ApplicationTest extends ApplicationTestCase<Application> {
|
||||
public ApplicationTest() {
|
||||
super(Application.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.nelosan.baselibrary" >
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<application/>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,462 @@
|
|||
package com.nelosan.baselibrary;
|
||||
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.Context;
|
||||
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.nelosan.baselibrary.command.CommandBase;
|
||||
import com.nelosan.baselibrary.dialog.DialogBuscar;
|
||||
import com.nelosan.baselibrary.fragment.FragmentBase;
|
||||
import com.nelosan.baselibrary.model.ResultadoBusqueda;
|
||||
import com.nelosan.baselibrary.toolbar.ToolbarBuscar;
|
||||
import com.nelosan.baselibrary.toolbar.ToolbarColores;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class ActivityBase extends AppCompatActivity {
|
||||
|
||||
/*************************************************** PROPIEDADES ***************************************************
|
||||
-FRAGMENT_CARGA: Fragment que mostrar por defecto para indicar que se esta realizando una acción de coste elevado.
|
||||
-Pref: Preferencias de nuestra aplicación.
|
||||
-Progress: Barra de progreso que se puede mostrar en algunos fragmentos. Desaparecera cuando termine una actividad larga.
|
||||
-Session: Clase singleton para almacenar valores y clases complejas y pasarlas entre actividades.
|
||||
-DrawerLayout: Controla el navigation drawer.
|
||||
-LnrDerecha/Izquierda: Contenido de los correspondientes navigationdrawer.
|
||||
-Ejecutando: Indica si una tarea asincrona se esta ejecutando en este momento.
|
||||
-FragmentActivo: El fragment que se esta mostrando actualmente ne pantalla.
|
||||
-Contenedor: El contenedor de los fragments.
|
||||
-Toolbar: La barra de navegación de la aplicación.
|
||||
****************************************************************************************************************************/
|
||||
|
||||
protected ProgressBar progress;
|
||||
|
||||
protected DrawerLayout drawerLayout;
|
||||
protected LinearLayout lnrDerecha, lnrIzquierda;
|
||||
|
||||
protected boolean ejecutando = false;
|
||||
protected FragmentBase fragmentActivo, fragmentSecundario;
|
||||
protected int contenedor, contenedor_izquierdo;
|
||||
protected Toolbar toolbar;
|
||||
|
||||
|
||||
/******************OVERRIDE**********************/
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
/** Inicializamos las preferencias y la session **/
|
||||
setContentView(R.layout.activity_base);
|
||||
//session = Session.getInstance();
|
||||
contenedor = R.id.contenedor;
|
||||
if (findViewById(R.id.contenedor_izquierdo) != null) {
|
||||
contenedor_izquierdo = R.id.contenedor_izquierdo;
|
||||
}
|
||||
|
||||
toolbar = (Toolbar)findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
toolbar.setContentInsetsAbsolute(0, 0);
|
||||
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||
ToolbarColores tool = new ToolbarColores(this, getTitle().toString(), false);
|
||||
crearToolbar(tool);
|
||||
createNavigationDrawer(null, null);
|
||||
overridePendingTransition(0,0);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
ejecutando = false;
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
|
||||
/** Controla el comportamiento de la aplicación al pulsar el boton de volver atras.
|
||||
* Si hay una tarea asincrona en ejecución, marcamos su ejecución como falso.
|
||||
* Si hay un navigationdrawer mostrandose en pantalla, se cierra.
|
||||
* Si no, ejecutamos la acción definida en la funcion backPress.
|
||||
*/
|
||||
|
||||
ejecutando = false;
|
||||
if(drawerLayout.isDrawerOpen(Gravity.LEFT))
|
||||
drawerLayout.closeDrawer(Gravity.LEFT);
|
||||
else if(drawerLayout.isDrawerOpen(Gravity.RIGHT))
|
||||
drawerLayout.closeDrawer(Gravity.RIGHT);
|
||||
else if(compararToolbar(ToolbarBuscar.class))
|
||||
{}
|
||||
else
|
||||
{
|
||||
backPress();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************/
|
||||
|
||||
|
||||
/******************NAVIGATION DRAWER**********************/
|
||||
|
||||
protected void createNavigationDrawer(View vIzquierda, View vDerecha)
|
||||
{
|
||||
/** Inicialización de los navigationdrawer **/
|
||||
|
||||
drawerLayout = (DrawerLayout) findViewById(R.id.main_navigation_drawer);
|
||||
|
||||
lnrDerecha = (LinearLayout) findViewById(R.id.contenido_navigation_drawer_derecha);
|
||||
lnrIzquierda = (LinearLayout)findViewById(R.id.contenido_navigation_drawer_izquierda);
|
||||
|
||||
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, findViewById(R.id.contenido_navigation_drawer_izquierda));
|
||||
|
||||
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, findViewById(R.id.contenido_navigation_drawer_derecha));
|
||||
|
||||
if(vIzquierda != null) {
|
||||
lnrIzquierda.addView(vIzquierda);
|
||||
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, findViewById(R.id.contenido_navigation_drawer_izquierda));
|
||||
}
|
||||
else
|
||||
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, findViewById(R.id.contenido_navigation_drawer_izquierda));
|
||||
|
||||
if(vDerecha != null) {
|
||||
lnrDerecha.addView(vDerecha);
|
||||
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, findViewById(R.id.contenido_navigation_drawer_derecha));
|
||||
}
|
||||
else
|
||||
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, findViewById(R.id.contenido_navigation_drawer_derecha));
|
||||
}
|
||||
|
||||
public DrawerLayout getDrawerLayout() {
|
||||
return drawerLayout;
|
||||
}
|
||||
|
||||
public void abrirDrawerIzquierdo()
|
||||
{
|
||||
drawerLayout.openDrawer(Gravity.LEFT);
|
||||
}
|
||||
|
||||
public void abrirDrawerDerecho()
|
||||
{
|
||||
drawerLayout.openDrawer(Gravity.RIGHT);
|
||||
}
|
||||
|
||||
public void cerrarDrawerIzquierdo()
|
||||
{
|
||||
drawerLayout.closeDrawer(Gravity.LEFT);
|
||||
}
|
||||
|
||||
public void cerrarDrawerDerecho()
|
||||
{
|
||||
drawerLayout.closeDrawer(Gravity.RIGHT);
|
||||
}
|
||||
|
||||
/********************************************************/
|
||||
|
||||
/******************TOOLBAR**********************/
|
||||
|
||||
public void crearToolbar(View view, int color, int darkColor)
|
||||
{
|
||||
if(mostrarToolbar(view)) {
|
||||
toolbar.removeAllViews();
|
||||
toolbar.addView(view);
|
||||
toolbar.setBackgroundColor(color);
|
||||
pintarBarraSuperior(darkColor);
|
||||
toolbar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
toolbar.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public void pintarBarraSuperior(int darkColor)
|
||||
{
|
||||
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
|
||||
if (currentapiVersion >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
getWindow().setStatusBarColor(darkColor);
|
||||
}
|
||||
}
|
||||
|
||||
public void crearToolbar(View view)
|
||||
{
|
||||
if(mostrarToolbar(view)) {
|
||||
toolbar.removeAllViews();
|
||||
toolbar.addView(view);
|
||||
int colorNegro = getResources().getColor(R.color.negro);
|
||||
toolbar.setBackgroundColor(colorNegro);
|
||||
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
|
||||
if (currentapiVersion >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
getWindow().setStatusBarColor(colorNegro);
|
||||
}
|
||||
toolbar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
toolbar.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean mostrarToolbar(View view)
|
||||
{
|
||||
if(view == null)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void setToolbarColores(int color, int darkColor)
|
||||
{
|
||||
toolbar.setBackgroundColor(color);
|
||||
|
||||
/** En caso de ser Lollipop, cambiamos el color de statusbar **/
|
||||
|
||||
int currentapiVersion = Build.VERSION.SDK_INT;
|
||||
if(currentapiVersion >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
getWindow().setStatusBarColor(darkColor);
|
||||
}
|
||||
}
|
||||
|
||||
public Toolbar getToolbar() {
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
public boolean compararToolbar(Class tool)
|
||||
{
|
||||
String currentToolbar = toolbar.getChildAt(0).getClass().toString();
|
||||
String toolCompare = tool.toString();
|
||||
return currentToolbar.equals(toolCompare);
|
||||
}
|
||||
|
||||
public int getToolbarColor()
|
||||
{
|
||||
return ((ColorDrawable)getToolbar().getBackground()).getColor();
|
||||
}
|
||||
|
||||
public int getToolbarDarkColor()
|
||||
{
|
||||
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
|
||||
if(currentapiVersion >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
return getWindow().getStatusBarColor();
|
||||
}
|
||||
|
||||
return getResources().getColor(R.color.negro);
|
||||
}
|
||||
|
||||
public void buscar(String cadena) {}
|
||||
|
||||
public void autocompletarDialog(String cadena, DialogBuscar dialog) {}
|
||||
|
||||
public void clickItemDialogBuscar(ResultadoBusqueda resultado) {}
|
||||
|
||||
public void clickImagenDialog(DialogBuscar dialog) {}
|
||||
|
||||
/************************************************/
|
||||
|
||||
/******************FRAGMENTS**********************/
|
||||
|
||||
public boolean compararFragments(Class frag) {
|
||||
|
||||
if(fragmentActivo != null && frag != null)
|
||||
{
|
||||
String currentFragment = fragmentActivo.getClass().toString();
|
||||
String fragment = frag.toString();
|
||||
return currentFragment.equals(fragment);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void cambiarFragment(FragmentBase fragment)
|
||||
{
|
||||
/** Cambia el fragment activo **/
|
||||
fragmentActivo = fragment;
|
||||
cambiarFragment(fragment, null);
|
||||
}
|
||||
|
||||
public void cambiarFragment(FragmentBase fragment, Bundle bundle)
|
||||
{
|
||||
cambiarFragment(fragment, null, bundle);
|
||||
}
|
||||
|
||||
public void cambiarFragment(FragmentBase fragmentContenedor, FragmentBase fragmentIzquierdo, Bundle bundle)
|
||||
{
|
||||
ejecutando = false;
|
||||
FragmentTransaction transaccion = getFragmentManager().beginTransaction();
|
||||
fragmentActivo = fragmentContenedor;
|
||||
fragmentSecundario = fragmentIzquierdo;
|
||||
if(fragmentSecundario != null)
|
||||
{
|
||||
fragmentSecundario.getView().setVisibility(View.VISIBLE);
|
||||
fragmentSecundario.setArguments(bundle);
|
||||
transaccion.replace(contenedor_izquierdo, fragmentSecundario, fragmentIzquierdo.getClass().getName());
|
||||
}
|
||||
fragmentActivo.setArguments(bundle);
|
||||
|
||||
transaccion.replace(contenedor, fragmentActivo, fragmentContenedor.getClass().getName());
|
||||
transaccion.addToBackStack(null);
|
||||
transaccion.commit();
|
||||
}
|
||||
|
||||
protected void backPress(){
|
||||
fragmentActivo = (FragmentBase) getFragmentManager().findFragmentById(R.id.contenedor);
|
||||
}
|
||||
|
||||
/***********************************************/
|
||||
|
||||
/******************COMMANDS**********************/
|
||||
|
||||
public void execute(CommandBase cmd)
|
||||
{
|
||||
/** Ejecuta una tarea asincrona **/
|
||||
boolean ejecutar = true;
|
||||
|
||||
if (cmd.isNeedInternet() && !isOnline()) {
|
||||
Toast.makeText(this, getResources().getString(R.string.no_internet), Toast.LENGTH_SHORT).show();
|
||||
ejecutar = false;
|
||||
}
|
||||
|
||||
if(ejecutar)
|
||||
{
|
||||
ejecutando = true;
|
||||
cmd.execute(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean isOnline()
|
||||
{
|
||||
/** Comprueba que hay conexión a internet **/
|
||||
|
||||
ConnectivityManager cm = (ConnectivityManager)this.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
return cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isConnectedOrConnecting();
|
||||
}
|
||||
|
||||
public boolean isEjecutando() {
|
||||
return ejecutando;
|
||||
}
|
||||
|
||||
public void setEjecutando(boolean ejecutando) {
|
||||
this.ejecutando = ejecutando;
|
||||
}
|
||||
|
||||
|
||||
public void setProgress(ProgressBar p)
|
||||
{
|
||||
this.progress = p;
|
||||
}
|
||||
|
||||
/************************************************/
|
||||
|
||||
/******************COMUNES**********************/
|
||||
|
||||
public void abrirTeclado(EditText myEditText)
|
||||
{
|
||||
myEditText.requestFocus();
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
|
||||
}
|
||||
|
||||
public void cerrarTeclado(EditText myEditText)
|
||||
{
|
||||
/** Oculta el teclado **/
|
||||
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
|
||||
}
|
||||
|
||||
protected void closeApp()
|
||||
{
|
||||
finish();
|
||||
}
|
||||
|
||||
public void startAnimation(int anim, View resource, Animation.AnimationListener listner)
|
||||
{
|
||||
/** Ejecuta una animación **/
|
||||
|
||||
Animation animacion = AnimationUtils.loadAnimation(this, anim);
|
||||
if(listner != null)
|
||||
animacion.setAnimationListener(listner);
|
||||
animacion.reset(); // reset initialization state
|
||||
animacion.setRepeatMode(Animation.RESTART);
|
||||
animacion.setRepeatCount(Animation.INFINITE);
|
||||
resource.startAnimation(animacion);
|
||||
}
|
||||
|
||||
public Animation.AnimationListener crearAnimationListener(final Object obj, final String met, final Class[] typeParameters, final Object[] parameters)
|
||||
{
|
||||
|
||||
/** Ejecuta un método por reflexión una vez ha finalizado una animación.
|
||||
* obj: Es el objeto que contiene el método.
|
||||
* met: Es el nombre del método a ejecutar.
|
||||
* typeParameters: Es un array que indica el tipo de parámetros del método.
|
||||
* parameters: Array de parámetros del método.
|
||||
**/
|
||||
|
||||
Animation.AnimationListener end = new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
try {
|
||||
Method method = obj.getClass().getMethod(met, typeParameters);
|
||||
method.invoke(obj, parameters);
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
return end;
|
||||
}
|
||||
|
||||
/**********************************************/
|
||||
|
||||
public void setFragmentActivo(FragmentBase fragmentActivo) {
|
||||
this.fragmentActivo = fragmentActivo;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package com.nelosan.baselibrary;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import androidx.multidex.MultiDex;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.nelosan.baselibrary.core.CircleTransform;
|
||||
import com.nelosan.baselibrary.core.RoundedTransformation;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* Created by nelo on 2/02/15.
|
||||
*/
|
||||
|
||||
public class MyApplication extends Application {
|
||||
|
||||
private static Context mContext;
|
||||
private static Picasso mPicasso;
|
||||
|
||||
/*****************IMAGEVIEW TRANSFORMATIONS*********************/
|
||||
public static int TRANSFORM_NONE = 100;
|
||||
public static int TRANSFORM_CIRCLE = 101;
|
||||
public static int TRANSFORM_ROUNDED = 102;
|
||||
public static int TRANSFORM_INSIDE = 103;
|
||||
public static int TRANSFORM_FULL = 104;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
mContext = getApplicationContext();
|
||||
mPicasso = new Picasso.Builder(mContext).executor(Executors.newSingleThreadExecutor()).build();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
MultiDex.install(base);
|
||||
}
|
||||
|
||||
|
||||
public static Context getContext() {
|
||||
return mContext;
|
||||
}
|
||||
|
||||
public static void downloadImg(String url, ImageView imgFoto, int transform)
|
||||
{
|
||||
|
||||
if(transform == TRANSFORM_NONE)
|
||||
{
|
||||
mPicasso.load(url)
|
||||
.fit()
|
||||
.centerCrop()
|
||||
.into(imgFoto);
|
||||
}
|
||||
else if(transform == TRANSFORM_CIRCLE)
|
||||
{
|
||||
mPicasso.load(url)
|
||||
.transform(new CircleTransform())
|
||||
//.fit()
|
||||
.into(imgFoto);
|
||||
}
|
||||
else if(transform == TRANSFORM_ROUNDED)
|
||||
{
|
||||
mPicasso.load(url)
|
||||
.transform(new RoundedTransformation(12, 0))
|
||||
.fit()
|
||||
.into(imgFoto);
|
||||
|
||||
}
|
||||
else if(transform == TRANSFORM_INSIDE)
|
||||
{
|
||||
mPicasso.load(url)
|
||||
.fit()
|
||||
.into(imgFoto);
|
||||
}
|
||||
else if(transform == TRANSFORM_FULL){
|
||||
mPicasso.load(url)
|
||||
.into(imgFoto);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
package com.nelosan.baselibrary.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
import com.nelosan.baselibrary.R;
|
||||
import com.nelosan.baselibrary.components.TextViewRoboto;
|
||||
import com.nelosan.baselibrary.model.CalendarItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.nelosan.baselibrary.core.Util.isInt;
|
||||
|
||||
/**
|
||||
* Created by nelo on 15/06/15.
|
||||
*/
|
||||
public class AdapterCalendar extends ArrayAdapter<CalendarItem> {
|
||||
|
||||
LayoutInflater li;
|
||||
Resources res;
|
||||
Context context;
|
||||
|
||||
public AdapterCalendar(Context context, int resource, List<CalendarItem> objects) {
|
||||
super(context, resource, objects);
|
||||
|
||||
li = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
res = context.getResources();
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public class CalendarHolder {
|
||||
public TextView txtDia;
|
||||
public LinearLayout lnrDia;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
CalendarItem dia = getItem(position);
|
||||
//Inflate the view
|
||||
CalendarHolder calendarHolder;
|
||||
|
||||
if (convertView == null) {
|
||||
calendarHolder = new CalendarHolder();
|
||||
convertView = li.inflate(R.layout.item_calendar, null);
|
||||
calendarHolder.txtDia = (TextView)convertView.findViewById(R.id.textview_item_calendar_dia);
|
||||
calendarHolder.lnrDia = (LinearLayout)convertView.findViewById(R.id.linear_item_calendar_dia);
|
||||
convertView.setTag(calendarHolder);
|
||||
} else {
|
||||
calendarHolder = (CalendarHolder)convertView.getTag();
|
||||
}
|
||||
|
||||
calendarHolder.txtDia.setText(dia.getValue());
|
||||
|
||||
|
||||
if(!isInt(dia.getValue())) {
|
||||
setParameters(calendarHolder, 12, R.color.negro, R.color.blanco, R.color.blanco);
|
||||
}
|
||||
else
|
||||
{
|
||||
int textColor;
|
||||
if(dia.isClick())
|
||||
{
|
||||
textColor = R.color.negro;
|
||||
}
|
||||
else
|
||||
{
|
||||
textColor = R.color.gris_separacion;
|
||||
}
|
||||
|
||||
setParameters(calendarHolder, 14, textColor, R.color.blanco, R.color.blanco);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(dia.isSelected())
|
||||
{
|
||||
setParameters(calendarHolder, 14, R.color.blanco, R.color.azul_claro, R.color.azul_claro);
|
||||
}
|
||||
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
public void setParameters(CalendarHolder holder, int textSize, int textColot, int diaBack, int lnrBack)
|
||||
{
|
||||
//holder.txtDia.setTextSize(context.getResources().getDimension(textSize));
|
||||
holder.txtDia.setTextSize(textSize);
|
||||
holder.txtDia.setTextColor(context.getResources().getColor(textColot));
|
||||
holder.txtDia.setBackgroundColor(context.getResources().getColor(diaBack));
|
||||
holder.lnrDia.setBackgroundColor(context.getResources().getColor(lnrBack));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package com.nelosan.baselibrary.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nelosan.baselibrary.MyApplication;
|
||||
import com.nelosan.baselibrary.R;
|
||||
import com.nelosan.baselibrary.model.ResultadoBusqueda;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Created by nelo on 30/03/15.
|
||||
*/
|
||||
public class AdapterResultadosBusqueda extends ArrayAdapter<ResultadoBusqueda> {
|
||||
|
||||
LayoutInflater li;
|
||||
Resources res;
|
||||
|
||||
public AdapterResultadosBusqueda(Context context, int resource, List<ResultadoBusqueda> objects) {
|
||||
super(context, resource, objects);
|
||||
|
||||
this.li = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
this.res = context.getResources();
|
||||
}
|
||||
|
||||
private class ResultadoBusquedaHolder {
|
||||
ImageView imgFoto;
|
||||
TextView txtArticle;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
ResultadoBusqueda resultado = getItem(position);
|
||||
//Inflate the view
|
||||
ResultadoBusquedaHolder resultadoHolder;
|
||||
|
||||
if (convertView == null) {
|
||||
resultadoHolder = new ResultadoBusquedaHolder();
|
||||
convertView = li.inflate(R.layout.item_resultados_buscar, null);
|
||||
resultadoHolder.txtArticle = (TextView)convertView.findViewById(R.id.textview_item_resultado_buscar_texto);
|
||||
resultadoHolder.imgFoto = (ImageView)convertView.findViewById(R.id.imageview_item_resultado_buscar_foto);
|
||||
|
||||
convertView.setTag(resultadoHolder);
|
||||
} else {
|
||||
resultadoHolder = (ResultadoBusquedaHolder)convertView.getTag();
|
||||
}
|
||||
|
||||
resultadoHolder.txtArticle.setText(resultado.getNombre());
|
||||
if(!resultado.getUrl().equals(""))
|
||||
MyApplication.downloadImg(resultado.getUrl(), resultadoHolder.imgFoto, MyApplication.TRANSFORM_CIRCLE);
|
||||
|
||||
return convertView;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
package com.nelosan.baselibrary.command;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.AsyncTask;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.nelosan.baselibrary.ActivityBase;
|
||||
import com.nelosan.baselibrary.R;
|
||||
import com.nelosan.baselibrary.core.CommandError;
|
||||
import com.nelosan.baselibrary.core.CommandOperation;
|
||||
import com.nelosan.baselibrary.core.FacadeException;
|
||||
|
||||
public class CommandBase extends AsyncTask<ActivityBase, Void, Void>{
|
||||
|
||||
/*************************************************** PROPIEDADES ***************************************************
|
||||
-Activity: Actividad que ejecuta la tarea asíncrona.
|
||||
-errorMessage: Mensaje de error que se muestra si falla algo en la ejecución de la tarea.
|
||||
-Start/End: Interface que se utiliza para ejecutar una operación antes o despues de ejecutar una tarea asíncrona.
|
||||
-succesMessage: Mensaje que se muestra si la tarea se ha ejecutado correctamente.
|
||||
****************************************************************************************************************************/
|
||||
|
||||
protected ActivityBase activity;
|
||||
private String errorMessage = "";
|
||||
private CommandOperation start, finished;
|
||||
private CommandError errorManager;
|
||||
private String succesMessage = "";
|
||||
protected boolean needInternet = true;
|
||||
protected boolean showError = true;
|
||||
protected String message = "";
|
||||
|
||||
@Override
|
||||
protected final Void doInBackground(ActivityBase... params) {
|
||||
|
||||
activity = params[0];
|
||||
|
||||
try {
|
||||
Execute();
|
||||
} catch (FacadeException ex) {
|
||||
String msg = ex.getMessage();
|
||||
if (msg != null && msg.length() > 0) {
|
||||
errorMessage = msg;
|
||||
} else {
|
||||
errorMessage = ex.toString();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
errorMessage = ex.getMessage();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void Execute() {}
|
||||
|
||||
@Override
|
||||
protected final void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
Start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void onPostExecute(Void result) {
|
||||
super.onPostExecute(result);
|
||||
if(activity.isEjecutando()) {
|
||||
if (!errorMessage.equals("") && showError) {
|
||||
mostrarAviso();
|
||||
} else {
|
||||
Finished();
|
||||
if (succesMessage.length() > 0)
|
||||
Toast.makeText(activity, succesMessage, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setOnFinished(CommandOperation finished){
|
||||
this.finished = finished;
|
||||
}
|
||||
|
||||
public void setErrorManager(CommandError errorManager){
|
||||
this.errorManager = errorManager;
|
||||
}
|
||||
|
||||
private void Finished(){
|
||||
if(finished!= null)
|
||||
finished.Realice(this);
|
||||
}
|
||||
|
||||
private void Start(){
|
||||
if(start!= null)
|
||||
start.Realice(this);
|
||||
}
|
||||
|
||||
public void setSuccesMessage(String message)
|
||||
{
|
||||
this.succesMessage = message;
|
||||
}
|
||||
|
||||
public boolean isNeedInternet() {
|
||||
return needInternet;
|
||||
}
|
||||
|
||||
private void mostrarAviso()
|
||||
{
|
||||
/** Muestra un mensaje de error **/
|
||||
AlertDialog.Builder b = new AlertDialog.Builder(activity);
|
||||
b.setMessage(message);
|
||||
|
||||
b.setPositiveButton(activity.getResources().getString(R.string.aceptar), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.cancel();
|
||||
accept();
|
||||
}
|
||||
});
|
||||
|
||||
b.setNegativeButton(activity.getResources().getString(R.string.retry), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
retry();
|
||||
}
|
||||
});
|
||||
|
||||
b.setTitle("Error");
|
||||
b.show();
|
||||
}
|
||||
|
||||
public void retry()
|
||||
{
|
||||
if(errorManager != null)
|
||||
errorManager.Retry(this);
|
||||
}
|
||||
|
||||
public void accept()
|
||||
{
|
||||
if(errorManager != null)
|
||||
errorManager.Accept(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
package com.nelosan.baselibrary.components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nelosan.baselibrary.R;
|
||||
import com.nelosan.baselibrary.adapter.AdapterCalendar;
|
||||
import com.nelosan.baselibrary.controller.ControllerCalendar;
|
||||
import com.nelosan.baselibrary.core.OnChangeDate;
|
||||
import com.nelosan.baselibrary.model.CalendarItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by nelo on 15/06/15.
|
||||
*/
|
||||
public class Calendar extends LinearLayout {
|
||||
|
||||
private GridView gCalendar;
|
||||
|
||||
private TextViewRoboto txtCabecera;
|
||||
private ImageView imgPreview, imgNext;
|
||||
|
||||
private ControllerCalendar cCalendar;
|
||||
private List<CalendarItem> items;
|
||||
|
||||
private OnChangeDate change;
|
||||
|
||||
|
||||
public Calendar(final Context context) {
|
||||
super(context);
|
||||
initialize(context);
|
||||
}
|
||||
|
||||
public Calendar(Context context, AttributeSet attrs)
|
||||
{
|
||||
super(context, attrs);
|
||||
initialize(context);
|
||||
}
|
||||
|
||||
public Calendar(Context context, AttributeSet attrs, int defStyle)
|
||||
{
|
||||
super(context, attrs, defStyle);
|
||||
initialize(context);
|
||||
}
|
||||
|
||||
public void initialize(final Context context)
|
||||
{
|
||||
LayoutInflater.from(context).inflate(R.layout.calendar, this);
|
||||
|
||||
cCalendar = new ControllerCalendar(getContext());
|
||||
|
||||
gCalendar = (GridView)findViewById(R.id.calendar);
|
||||
txtCabecera = (TextViewRoboto)findViewById(R.id.calendar_textview_cabecera);
|
||||
imgPreview = (ImageView)findViewById(R.id.calendar_imageview_previous_month);
|
||||
imgNext = (ImageView)findViewById(R.id.calendar_imageview_next_month);
|
||||
|
||||
imgPreview.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
cCalendar.addMonthCalendar(-1);
|
||||
generarCalendario(context);
|
||||
dibujarCabecera();
|
||||
}
|
||||
});
|
||||
|
||||
imgNext.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
cCalendar.addMonthCalendar(+1);
|
||||
generarCalendario(context);
|
||||
dibujarCabecera();
|
||||
}
|
||||
});
|
||||
|
||||
gCalendar.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
|
||||
|
||||
CalendarItem item = (CalendarItem) adapter.getItemAtPosition(position);
|
||||
|
||||
if(item.isClick())
|
||||
{
|
||||
for (CalendarItem it : items)
|
||||
{
|
||||
it.setSelected(false);
|
||||
}
|
||||
|
||||
item.setSelected(true);
|
||||
|
||||
cCalendar.selectDate(item);
|
||||
|
||||
generarCalendario(context);
|
||||
changeDate();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
items = cCalendar.generateArrayDays();
|
||||
|
||||
generarCalendario(context);
|
||||
dibujarCabecera();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void dibujarCabecera()
|
||||
{
|
||||
txtCabecera.setText(cCalendar.getTextMonth());
|
||||
if(cCalendar.getActualMonth() == cCalendar.getMonth()
|
||||
&& cCalendar.getActualYear() == cCalendar.getYear())
|
||||
imgPreview.setVisibility(View.INVISIBLE);
|
||||
else
|
||||
imgPreview.setVisibility(View.VISIBLE);
|
||||
txtCabecera.setTypeface(TextViewRoboto.ROBOTO_THIN);
|
||||
}
|
||||
|
||||
public void generarCalendario(Context context)
|
||||
{
|
||||
items = cCalendar.generateArrayDays();
|
||||
AdapterCalendar adapter = new AdapterCalendar(context, R.id.calendar, items);
|
||||
gCalendar.setAdapter(adapter);
|
||||
}
|
||||
|
||||
public void setOnChangeDate(OnChangeDate change)
|
||||
{
|
||||
this.change = change;
|
||||
}
|
||||
|
||||
public void changeDate()
|
||||
{
|
||||
if(this.change != null)
|
||||
change.OnChangeDate(cCalendar.getSelectedYear(), cCalendar.getSelectedMonth(), cCalendar.getSelectedDay());
|
||||
}
|
||||
|
||||
public void setDate(int year, int month, int day)
|
||||
{
|
||||
cCalendar.setDate(year, month, day);
|
||||
generarCalendario(getContext());
|
||||
dibujarCabecera();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.nelosan.baselibrary.components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* Created by nelo on 16/04/15.
|
||||
*/
|
||||
public class TextViewRoboto extends TextView {
|
||||
|
||||
public static final String ROBOTO_BLACK = "Roboto-Black.ttf";
|
||||
public static final String ROBOTO_BLACK_ITALIC = "Roboto-BlackItalic.ttf";
|
||||
public static final String ROBOTO_BOLD = "Roboto-Bold.ttf";
|
||||
public static final String ROBOTO_BOLD_ITALIC = "Roboto-BoldItalic.ttf";
|
||||
public static final String ROBOTO_ITALIC = "Roboto-Italic.ttf";
|
||||
public static final String ROBOTO_LIGHT = "Roboto-Light.ttf";
|
||||
public static final String ROBOTO_LIGT_ITALIC = "Roboto-LightItalic.ttf";
|
||||
public static final String ROBOTO_MEDIUM = "Roboto-Medium.ttf";
|
||||
public static final String ROBOTO_MEDIUM_ITALIC = "Roboto-MediumItalic.ttf";
|
||||
public static final String ROBOTO_REGULAR = "Roboto-Regular.ttf";
|
||||
public static final String ROBOTO_THIN = "Roboto-Thin.ttf";
|
||||
public static final String ROBOTO_THIN_ITALIC = "Roboto-ThinItalic.ttf";
|
||||
|
||||
private Context context;
|
||||
|
||||
public TextViewRoboto(Context context) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
setTypeface(ROBOTO_REGULAR);
|
||||
}
|
||||
|
||||
public TextViewRoboto(Context context, AttributeSet attrs)
|
||||
{
|
||||
super(context, attrs);
|
||||
this.context = context;
|
||||
setTypeface(ROBOTO_REGULAR);
|
||||
}
|
||||
|
||||
public TextViewRoboto(Context context, AttributeSet attrs, int defStyle)
|
||||
{
|
||||
super(context, attrs, defStyle);
|
||||
this.context = context;
|
||||
setTypeface(ROBOTO_REGULAR);
|
||||
}
|
||||
|
||||
public void setTypeface(String typeface)
|
||||
{
|
||||
Typeface face=Typeface.createFromAsset(context.getAssets(), "fonts/"+typeface);
|
||||
this.setTypeface(face);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,330 @@
|
|||
package com.nelosan.baselibrary.controller;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.nelosan.baselibrary.R;
|
||||
import com.nelosan.baselibrary.model.CalendarItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by nelo on 17/06/15.
|
||||
*/
|
||||
public class ControllerCalendar {
|
||||
|
||||
private java.util.Calendar calendar;
|
||||
|
||||
/**** FECHA ACTUAL ****/
|
||||
private int actualYear, actualMonth, actualDay;
|
||||
/**** FECHA DATOS ****/
|
||||
private int year, month, day;
|
||||
/**** FECHA SELECCIONADA ****/
|
||||
private int selectedYear, selectedMonth, selectedDay;
|
||||
|
||||
private Context context;
|
||||
|
||||
public ControllerCalendar(Context context)
|
||||
{
|
||||
/**** CONSTRUCTOR POR DEFECTO ****/
|
||||
this.context = context;
|
||||
initializeCalendar();
|
||||
setDate(actualYear, actualMonth, actualDay);
|
||||
}
|
||||
|
||||
public ControllerCalendar(Context context, int year, int month, int day)
|
||||
{
|
||||
/**** CONSTRUCTOR INDICANDO FECHA ****/
|
||||
this.context = context;
|
||||
initializeCalendar();
|
||||
setDate(year, month, day);
|
||||
}
|
||||
|
||||
public void initializeCalendar()
|
||||
{
|
||||
/**** INICIALIZAMOS EL CALENDARIO ****/
|
||||
calendar = new GregorianCalendar();
|
||||
actualMonth = calendar.get(java.util.Calendar.MONTH);
|
||||
actualYear = calendar.get(java.util.Calendar.YEAR);
|
||||
actualDay = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
}
|
||||
|
||||
public void setDate(int year, int month, int day)
|
||||
{
|
||||
/**** INICIALIZAMOS LOS VALORES ****/
|
||||
|
||||
this.year = year;
|
||||
this.month = month;
|
||||
this.day = day;
|
||||
|
||||
this.selectedYear = year;
|
||||
this.selectedMonth = month;
|
||||
this.selectedDay = day;
|
||||
|
||||
calendar.set(year, month, day);
|
||||
}
|
||||
|
||||
public List<CalendarItem> generateArrayDays()
|
||||
{
|
||||
return getMonthItems(year, month, day);
|
||||
}
|
||||
|
||||
public List<CalendarItem> getMonthItems(int year, int month, int day)
|
||||
{
|
||||
List<CalendarItem> days = new ArrayList<>();
|
||||
|
||||
/*** Generamos los días de la cabecera del calendario ***/
|
||||
getCalendarHeaderDays(days);
|
||||
|
||||
/*** Generamos los días del mes anterior ***/
|
||||
generatePreviousDays(year, month, days);
|
||||
|
||||
/*** Obtenemos el número de dias que tiene el mes ***/
|
||||
generateCurrentDays(days);
|
||||
|
||||
/*** Generamos los días del mes posterior ***/
|
||||
generatePostDays(year, month, days);
|
||||
|
||||
return days;
|
||||
}
|
||||
|
||||
private void getCalendarHeaderDays(List<CalendarItem> days)
|
||||
{
|
||||
String[] dias = {context.getResources().getString(R.string.calendar_monday),
|
||||
context.getResources().getString(R.string.calendar_tuesday),
|
||||
context.getResources().getString(R.string.calendar_wednesday),
|
||||
context.getResources().getString(R.string.calendar_thursday),
|
||||
context.getResources().getString(R.string.calendar_friday),
|
||||
context.getResources().getString(R.string.calendar_saturday),
|
||||
context.getResources().getString(R.string.calendar_sunday)};
|
||||
|
||||
for(String d : dias)
|
||||
{
|
||||
CalendarItem item = new CalendarItem();
|
||||
item.setValue(d);
|
||||
item.setClick(false);
|
||||
days.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void generatePreviousDays(int year, int month, List<CalendarItem> days)
|
||||
{
|
||||
|
||||
int leftDays = getFirstDayMonth(year, month);
|
||||
|
||||
java.util.Calendar cal = generateCalendar(year, month);
|
||||
cal.add(java.util.Calendar.MONTH, -1);
|
||||
int pMonth = cal.get(java.util.Calendar.MONTH);
|
||||
int pYear = cal.get(java.util.Calendar.YEAR);
|
||||
|
||||
int numDaysAnterior = getDaysInMonthInPresentYear(pYear, pMonth);
|
||||
|
||||
while (leftDays != 0) {
|
||||
|
||||
int pDay = numDaysAnterior - leftDays + 1;
|
||||
CalendarItem item = generateItem(pYear, pMonth, pDay, false);
|
||||
days.add(item);
|
||||
leftDays--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void generateCurrentDays(List<CalendarItem> days)
|
||||
{
|
||||
int numDays = getDaysInMonthInPresentYear(year, month);
|
||||
|
||||
for (int day = 1; day<= numDays; day++)
|
||||
{
|
||||
boolean click;
|
||||
if(day < this.actualDay && calendar.get(java.util.Calendar.MONTH) == actualMonth && calendar.get(java.util.Calendar.YEAR) == actualYear)
|
||||
click = false;
|
||||
else
|
||||
click = true;
|
||||
CalendarItem item = generateItem(year, month, day, click);
|
||||
days.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void generatePostDays(int year, int month, List<CalendarItem> days)
|
||||
{
|
||||
java.util.Calendar cal = generateCalendar(year, month);
|
||||
cal.add(java.util.Calendar.MONTH, 1);
|
||||
int nMonth = cal.get(java.util.Calendar.MONTH);
|
||||
int nYear = cal.get(java.util.Calendar.YEAR);
|
||||
int weekday = getFirstDayMonth(nYear, nMonth);
|
||||
int contador = weekday;
|
||||
|
||||
while (contador != 7) {
|
||||
int nDay = 1 + contador - weekday;
|
||||
CalendarItem item = generateItem(nYear, nMonth, nDay, false);
|
||||
days.add(item);
|
||||
contador++;
|
||||
}
|
||||
}
|
||||
|
||||
private CalendarItem generateItem(int year, int month, int day, boolean click)
|
||||
{
|
||||
CalendarItem item = new CalendarItem();
|
||||
item.setDay(day);
|
||||
item.setMonth(month);
|
||||
item.setYear(year);
|
||||
item.setValue("" + day);
|
||||
item.setClick(click);
|
||||
|
||||
if(this.selectedYear == year && this.selectedMonth == month && this.selectedDay == day)
|
||||
{
|
||||
item.setSelected(true);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private int getFirstDayMonth(int year, int month)
|
||||
{
|
||||
java.util.Calendar cal = generateCalendar(year, month);
|
||||
cal.set(java.util.Calendar.DAY_OF_MONTH, 1);
|
||||
switch (cal.get(java.util.Calendar.DAY_OF_WEEK)) {
|
||||
case java.util.Calendar.MONDAY:
|
||||
return 0;
|
||||
case java.util.Calendar.TUESDAY:
|
||||
return 1;
|
||||
case java.util.Calendar.WEDNESDAY:
|
||||
return 2;
|
||||
case java.util.Calendar.THURSDAY:
|
||||
return 3;
|
||||
case java.util.Calendar.FRIDAY:
|
||||
return 4;
|
||||
case java.util.Calendar.SATURDAY:
|
||||
return 5;
|
||||
case java.util.Calendar.SUNDAY:
|
||||
return 6;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int getDaysInMonthInPresentYear(int year, int month)
|
||||
{
|
||||
int days=0;
|
||||
if(month>=0 && month<12){
|
||||
try
|
||||
{
|
||||
java.util.Calendar calendar = java.util.Calendar.getInstance();
|
||||
int date = 1;
|
||||
calendar.set(year, month, date);
|
||||
days = calendar.getActualMaximum(java.util.Calendar.DAY_OF_MONTH);
|
||||
} catch (Exception e)
|
||||
{
|
||||
if(e!=null)
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return days;
|
||||
}
|
||||
|
||||
public String getTextMonth()
|
||||
{
|
||||
String text = "";
|
||||
java.util.Calendar cal = generateCalendar(year, month);
|
||||
switch (cal.get(java.util.Calendar.MONTH)) {
|
||||
case java.util.Calendar.JANUARY:
|
||||
text += context.getResources().getString(R.string.january);
|
||||
break;
|
||||
case java.util.Calendar.FEBRUARY:
|
||||
text += context.getResources().getString(R.string.february);
|
||||
break;
|
||||
case java.util.Calendar.MARCH:
|
||||
text += context.getResources().getString(R.string.march);
|
||||
break;
|
||||
case java.util.Calendar.APRIL:
|
||||
text += context.getResources().getString(R.string.april);
|
||||
break;
|
||||
case java.util.Calendar.MAY:
|
||||
text += context.getResources().getString(R.string.may);
|
||||
break;
|
||||
case java.util.Calendar.JUNE:
|
||||
text += context.getResources().getString(R.string.june);
|
||||
break;
|
||||
case java.util.Calendar.JULY:
|
||||
text += context.getResources().getString(R.string.july);
|
||||
break;
|
||||
case java.util.Calendar.AUGUST:
|
||||
text += context.getResources().getString(R.string.august);
|
||||
break;
|
||||
case java.util.Calendar.SEPTEMBER:
|
||||
text += context.getResources().getString(R.string.september);
|
||||
break;
|
||||
case java.util.Calendar.OCTOBER:
|
||||
text += context.getResources().getString(R.string.october);
|
||||
break;
|
||||
case java.util.Calendar.NOVEMBER:
|
||||
text += context.getResources().getString(R.string.november);
|
||||
break;
|
||||
case java.util.Calendar.DECEMBER:
|
||||
text += context.getResources().getString(R.string.december);
|
||||
break;
|
||||
}
|
||||
|
||||
text += " de "+year;
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
public java.util.Calendar generateCalendar(int year, int month)
|
||||
{
|
||||
java.util.Calendar cal = new GregorianCalendar();
|
||||
cal.set(java.util.Calendar.MONTH, month);
|
||||
cal.set(java.util.Calendar.YEAR, year);
|
||||
|
||||
return cal;
|
||||
}
|
||||
|
||||
public void addMonthCalendar(int mon)
|
||||
{
|
||||
calendar.add(java.util.Calendar.MONTH, mon);
|
||||
year = calendar.get(Calendar.YEAR);
|
||||
month = calendar.get(Calendar.MONTH);
|
||||
day = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
}
|
||||
|
||||
public void selectDate(CalendarItem item)
|
||||
{
|
||||
this.selectedYear = item.getYear();
|
||||
this.selectedMonth = item.getMonth();
|
||||
this.selectedDay = item.getDay();
|
||||
}
|
||||
|
||||
public int getActualYear() {
|
||||
return actualYear;
|
||||
}
|
||||
|
||||
public int getActualMonth() {
|
||||
return actualMonth;
|
||||
}
|
||||
|
||||
public Calendar getCalendar() {
|
||||
return calendar;
|
||||
}
|
||||
|
||||
public int getSelectedYear() {
|
||||
return selectedYear;
|
||||
}
|
||||
|
||||
public int getSelectedMonth() {
|
||||
return selectedMonth;
|
||||
}
|
||||
|
||||
public int getSelectedDay() {
|
||||
return selectedDay;
|
||||
}
|
||||
|
||||
public int getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public int getMonth() {
|
||||
return month;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package com.nelosan.baselibrary.core;
|
||||
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapShader;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
|
||||
import com.squareup.picasso.Transformation;
|
||||
|
||||
/**
|
||||
* Created by nelo on 21/01/15.
|
||||
*/
|
||||
public class CircleTransform implements Transformation {
|
||||
@Override
|
||||
public Bitmap transform(Bitmap source) {
|
||||
int size = Math.min(source.getWidth(), source.getHeight());
|
||||
|
||||
int x = (source.getWidth() - size) / 2;
|
||||
int y = (source.getHeight() - size) / 2;
|
||||
|
||||
Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size);
|
||||
if (squaredBitmap != source) {
|
||||
source.recycle();
|
||||
}
|
||||
|
||||
Bitmap bitmap = Bitmap.createBitmap(size, size, source.getConfig());
|
||||
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
Paint paint = new Paint();
|
||||
BitmapShader shader = new BitmapShader(squaredBitmap, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);
|
||||
paint.setShader(shader);
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
float r = size/2f;
|
||||
canvas.drawCircle(r, r, r, paint);
|
||||
|
||||
|
||||
squaredBitmap.recycle();
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String key() {
|
||||
return "circle";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.nelosan.baselibrary.core;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapShader;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
|
||||
import com.squareup.picasso.Transformation;
|
||||
|
||||
/**
|
||||
* Created by nelo on 27/05/15.
|
||||
*/
|
||||
public class CircleTransformBorder implements Transformation {
|
||||
private final int BORDER_COLOR = Color.WHITE;
|
||||
private final int BORDER_RADIUS = 5;
|
||||
|
||||
@Override
|
||||
public Bitmap transform(Bitmap source) {
|
||||
int size = Math.min(source.getWidth(), source.getHeight());
|
||||
|
||||
int x = (source.getWidth() - size) / 2;
|
||||
int y = (source.getHeight() - size) / 2;
|
||||
|
||||
Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size);
|
||||
if (squaredBitmap != source) {
|
||||
source.recycle();
|
||||
}
|
||||
|
||||
Bitmap bitmap = Bitmap.createBitmap(size, size, source.getConfig());
|
||||
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
Paint paint = new Paint();
|
||||
BitmapShader shader = new BitmapShader(squaredBitmap, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);
|
||||
paint.setShader(shader);
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
float r = size / 2f;
|
||||
|
||||
// Prepare the background
|
||||
Paint paintBg = new Paint();
|
||||
paintBg.setColor(BORDER_COLOR);
|
||||
paintBg.setAntiAlias(true);
|
||||
|
||||
// Draw the background circle
|
||||
canvas.drawCircle(r, r, r, paintBg);
|
||||
|
||||
// Draw the image smaller than the background so a little border will be seen
|
||||
canvas.drawCircle(r, r, r - BORDER_RADIUS, paint);
|
||||
|
||||
squaredBitmap.recycle();
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String key() {
|
||||
return "circle";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.nelosan.baselibrary.core;
|
||||
|
||||
import com.nelosan.baselibrary.command.CommandBase;
|
||||
|
||||
/**
|
||||
* Created by nelo on 27/10/15.
|
||||
*/
|
||||
public interface CommandError {
|
||||
public void Retry(CommandBase cmd);
|
||||
public void Accept(CommandBase cmd);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.nelosan.baselibrary.core;
|
||||
|
||||
import com.nelosan.baselibrary.command.CommandBase;
|
||||
|
||||
/**
|
||||
* Created by nelo on 13/01/15.
|
||||
*/
|
||||
public interface CommandOperation {
|
||||
public void Realice(CommandBase cmd);
|
||||
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
package com.nelosan.baselibrary.core;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
/**
|
||||
* Created by Jes<EFBFBD>s Tom<EFBFBD>s on 04/05/2015.
|
||||
*/
|
||||
public class DireccionesGestureDetector extends GestureDetector {
|
||||
|
||||
public interface OnDireccionesGestureListener extends OnGestureListener {
|
||||
boolean onDerecha(MotionEvent e1, MotionEvent e2, float distX, float distY);
|
||||
boolean onIzquierda(MotionEvent e1, MotionEvent e2, float distX, float distY);
|
||||
boolean onArriba(MotionEvent e1, MotionEvent e2, float distX, float distY);
|
||||
boolean onAbajo(MotionEvent e1, MotionEvent e2, float distX, float distY);
|
||||
}
|
||||
|
||||
OnDireccionesGestureListener listener;
|
||||
MotionEvent antiguaPulsacion;
|
||||
boolean pulsando = false;
|
||||
float distMin = 20;
|
||||
|
||||
public DireccionesGestureDetector(Context c, OnDireccionesGestureListener listener) {
|
||||
super(c, listener);
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public boolean onTouchEvent(MotionEvent evento) {
|
||||
boolean procesado = false;
|
||||
if (evento.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
antiguaPulsacion = MotionEvent.obtain(evento);
|
||||
pulsando = true;
|
||||
} else if (evento.getAction() == MotionEvent.ACTION_UP && pulsando) {
|
||||
pulsando = false;
|
||||
float distX = antiguaPulsacion.getX() - evento.getX();
|
||||
float distY = antiguaPulsacion.getY() - evento.getY();
|
||||
if ((Math.abs(distX / distY) > 2) && (distX > distMin)) {
|
||||
procesado = listener.onIzquierda(antiguaPulsacion, evento, distX, distY);
|
||||
}
|
||||
if ((Math.abs(distX / distY) > 2) && (-distX > distMin)) {
|
||||
procesado = listener.onDerecha(antiguaPulsacion, evento, distX, distY);
|
||||
}
|
||||
if ((Math.abs(distY / distX) > 2) && (distY > distMin)) {
|
||||
procesado = listener.onArriba(antiguaPulsacion, evento, distX, distY);
|
||||
}
|
||||
if ((Math.abs(distY / distX) > 2) && (-distY > distMin)) {
|
||||
procesado = listener.onAbajo(antiguaPulsacion, evento, distX, distY);
|
||||
}
|
||||
}
|
||||
return procesado || super.onTouchEvent(evento);
|
||||
}
|
||||
|
||||
|
||||
public static class SimpleOnDireccionesGestureListener
|
||||
extends SimpleOnGestureListener
|
||||
implements OnDireccionesGestureListener{
|
||||
|
||||
@Override
|
||||
public boolean onDerecha(MotionEvent e1, MotionEvent e2, float distX, float distY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onIzquierda(MotionEvent e1, MotionEvent e2, float distX, float distY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onArriba(MotionEvent e1, MotionEvent e2, float distX, float distY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onAbajo(MotionEvent e1, MotionEvent e2, float distX, float distY) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.nelosan.baselibrary.core;
|
||||
|
||||
public class ErrorInfo
|
||||
{
|
||||
private String Type;
|
||||
private String Message;
|
||||
|
||||
public String getType() {
|
||||
return Type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
Type = type;
|
||||
}
|
||||
public String getMessage() {
|
||||
return Message;
|
||||
}
|
||||
public void setMessage(String message) {
|
||||
Message = message;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.nelosan.baselibrary.core;
|
||||
|
||||
public class FacadeException extends RuntimeException{
|
||||
|
||||
public FacadeException(String s) { super(s); }
|
||||
private String Type;
|
||||
|
||||
public String getType() {
|
||||
return Type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
Type = type;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.nelosan.baselibrary.core;
|
||||
|
||||
public class FacadeUserException extends RuntimeException
|
||||
{
|
||||
public FacadeUserException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
|
||||
public FacadeUserException(String message, String Type)
|
||||
{
|
||||
super(message);
|
||||
this.Type = Type;
|
||||
}
|
||||
|
||||
public String Type;
|
||||
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
package com.nelosan.baselibrary.core;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Movie;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Dictionary;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by nelo on 30/01/15.
|
||||
*/
|
||||
public class FileManager {
|
||||
|
||||
|
||||
public static void guardarFichero(String filename, Object objeto, Context context)
|
||||
{
|
||||
FileOutputStream outputStream;
|
||||
Gson gson = new GsonBuilder().setDateFormat("dd/MM/yyyy").create();
|
||||
String json = gson.toJson(objeto);
|
||||
|
||||
try {
|
||||
outputStream = context.openFileOutput(filename, Context.MODE_PRIVATE);
|
||||
outputStream.write(json.getBytes());
|
||||
outputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static Object recuperarFichero(String filename, Type tipo, Context context)
|
||||
{
|
||||
Gson gson = new GsonBuilder().setDateFormat("dd/MM/yyyy").create();
|
||||
|
||||
String result = readFile(filename, context);
|
||||
|
||||
return gson.fromJson(result, tipo);
|
||||
}
|
||||
|
||||
public static <T> List<T> recuperarFicheroLista(String filename, final Class<T> tipo, Context context)
|
||||
{
|
||||
Gson gson = new GsonBuilder().setDateFormat("dd/MM/yyyy").create();
|
||||
|
||||
String result = readFile(filename, context);
|
||||
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonArray array = parser.parse(result).getAsJsonArray();
|
||||
|
||||
List<T> lst = new ArrayList<T>();
|
||||
for(final JsonElement json: array){
|
||||
T entity = gson.fromJson(json, tipo);
|
||||
lst.add(entity);
|
||||
}
|
||||
|
||||
return lst;
|
||||
}
|
||||
|
||||
public static Map<String, Object> recuperarSession(String filename, Context context)
|
||||
{
|
||||
String result = readFile(filename, context);
|
||||
|
||||
if(result.equals(""))
|
||||
return null;
|
||||
|
||||
Map<String, Object> map = new Gson().fromJson(result, new TypeToken<HashMap<String, Object>>() {}.getType());
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
public static void borrarFichero(String filename, Context context)
|
||||
{
|
||||
File dir = context.getFilesDir();
|
||||
File file = new File(dir, filename);
|
||||
file.delete();
|
||||
}
|
||||
|
||||
private static String readFile(String filename, Context context)
|
||||
{
|
||||
String result = "";
|
||||
try {
|
||||
FileInputStream inputStream = context.openFileInput(filename);
|
||||
BufferedReader entrada;
|
||||
entrada = new BufferedReader(new InputStreamReader(inputStream));
|
||||
String linea;
|
||||
do {
|
||||
linea = entrada.readLine();
|
||||
if(linea != null) {
|
||||
result += linea;
|
||||
}
|
||||
} while (linea != null);
|
||||
inputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.nelosan.baselibrary.core;
|
||||
|
||||
/**
|
||||
* Created by nelo on 13/01/15.
|
||||
*/
|
||||
public interface OnChangeDate {
|
||||
public void OnChangeDate(int year, int month, int day);
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.nelosan.baselibrary.core;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapShader;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Shader;
|
||||
|
||||
/**
|
||||
* Created by nelo on 4/06/15.
|
||||
*/
|
||||
public class RoundedTransformation implements com.squareup.picasso.Transformation {
|
||||
private final int radius;
|
||||
private final int margin; // dp
|
||||
|
||||
// radius is corner radii in dp
|
||||
// margin is the board in dp
|
||||
public RoundedTransformation(final int radius, final int margin) {
|
||||
this.radius = radius;
|
||||
this.margin = margin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bitmap transform(final Bitmap source) {
|
||||
final Paint paint = new Paint();
|
||||
paint.setAntiAlias(true);
|
||||
paint.setShader(new BitmapShader(source, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP));
|
||||
|
||||
Bitmap output = Bitmap.createBitmap(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(output);
|
||||
canvas.drawRoundRect(new RectF(margin, margin, source.getWidth() - margin, source.getHeight() - margin), radius, radius, paint);
|
||||
|
||||
if (source != output) {
|
||||
source.recycle();
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String key() {
|
||||
return "rounded";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.nelosan.baselibrary.core;
|
||||
|
||||
/**
|
||||
* Created by nelo on 24/06/15.
|
||||
*/
|
||||
public class Util {
|
||||
|
||||
public static boolean isInt(String s) {
|
||||
|
||||
try {
|
||||
Integer.parseInt(s);
|
||||
return true;
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,183 @@
|
|||
package com.nelosan.baselibrary.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.InputType;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nelosan.baselibrary.ActivityBase;
|
||||
import com.nelosan.baselibrary.R;
|
||||
import com.nelosan.baselibrary.adapter.AdapterResultadosBusqueda;
|
||||
import com.nelosan.baselibrary.model.ResultadoBusqueda;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Created by nelo on 30/03/15.
|
||||
*/
|
||||
public class DialogBuscar extends Dialog{
|
||||
|
||||
protected ActivityBase activity;
|
||||
protected ListView lstResultados;
|
||||
protected EditText edtBuscar;
|
||||
protected ImageView imgIcono, imgBack;
|
||||
protected int imagenId = -1;
|
||||
//private List<ResultadoBusqueda> busquedasAnteriores;
|
||||
|
||||
public static final String FILE_DIALOG_BUSCAR = "file_dialog_buscar.txt";
|
||||
|
||||
public DialogBuscar(ActivityBase a) {
|
||||
super(a);
|
||||
this.activity = a;
|
||||
}
|
||||
|
||||
public DialogBuscar(ActivityBase a, int image)
|
||||
{
|
||||
super(a);
|
||||
this.activity = a;
|
||||
this.imagenId = image;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.dialog_buscar);
|
||||
|
||||
WindowManager.LayoutParams wmlp = this.getWindow().getAttributes();
|
||||
wmlp.gravity = Gravity.TOP | Gravity.CENTER;
|
||||
wmlp.width = activity.getWindow().getAttributes().width;
|
||||
imgIcono = (ImageView) findViewById(R.id.imageview_dialog_buscar_icono);
|
||||
|
||||
if(imagenId != -1)
|
||||
{
|
||||
Drawable d = activity.getResources().getDrawable(imagenId);
|
||||
imgIcono.setImageDrawable(d);
|
||||
}
|
||||
|
||||
imgIcono.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
activity.clickImagenDialog(DialogBuscar.this);
|
||||
}
|
||||
});
|
||||
|
||||
edtBuscar = (EditText)findViewById(R.id.edittext_dialog_buscar_busqueda);
|
||||
|
||||
edtBuscar.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
|
||||
dismiss();
|
||||
activity.cerrarTeclado(edtBuscar);
|
||||
activity.buscar(edtBuscar.getText().toString());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
edtBuscar.addTextChangedListener(new TextWatcher() {
|
||||
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
activity.autocompletarDialog(s.toString(), DialogBuscar.this);
|
||||
}
|
||||
});
|
||||
|
||||
lstResultados = (ListView)findViewById(R.id.listview_dialog_buscar_resultados);
|
||||
|
||||
lstResultados.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
||||
activity.cerrarTeclado(edtBuscar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
lstResultados.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
ResultadoBusqueda resultado = (ResultadoBusqueda) parent.getItemAtPosition(position);
|
||||
onClickItem(resultado);
|
||||
}
|
||||
});
|
||||
|
||||
imgBack = (ImageView)findViewById(R.id.imageview_dialog_buscar_atras);
|
||||
imgBack.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
activity.cerrarTeclado(edtBuscar);
|
||||
DialogBuscar.this.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
activity.abrirTeclado(edtBuscar);
|
||||
|
||||
}
|
||||
|
||||
public void setResultados(List<ResultadoBusqueda> resultados)
|
||||
{
|
||||
List<ResultadoBusqueda> res = new ArrayList<ResultadoBusqueda>();
|
||||
//res.addAll(busquedasAnteriores);
|
||||
res.addAll(resultados);
|
||||
|
||||
AdapterResultadosBusqueda adapter = new AdapterResultadosBusqueda(activity, R.layout.item_resultados_buscar, res);
|
||||
lstResultados.setAdapter(adapter);
|
||||
}
|
||||
|
||||
protected void onClickItem(ResultadoBusqueda resultado) {
|
||||
dismiss();
|
||||
activity.clickItemDialogBuscar(resultado);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
activity.cerrarTeclado(edtBuscar);
|
||||
super.dismiss();
|
||||
}
|
||||
|
||||
|
||||
public int getImagenId() {
|
||||
return imagenId;
|
||||
}
|
||||
|
||||
public EditText getEdtBuscar() {
|
||||
return edtBuscar;
|
||||
}
|
||||
|
||||
public void setKeyboard(boolean isNumeric){
|
||||
if(isNumeric)
|
||||
edtBuscar.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||
else
|
||||
edtBuscar.setInputType(InputType.TYPE_CLASS_TEXT);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package com.nelosan.baselibrary.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.nelosan.baselibrary.ActivityBase;
|
||||
import com.nelosan.baselibrary.command.CommandBase;
|
||||
|
||||
|
||||
/**
|
||||
* Created by nelo on 12/01/15.
|
||||
*/
|
||||
public class FragmentBase extends Fragment {
|
||||
|
||||
private ActivityBase activity;
|
||||
protected ProgressBar progress;
|
||||
protected View contenedor;
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
this.activity = (ActivityBase) activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return super.onCreateView(inflater, container, savedInstanceState);
|
||||
}
|
||||
|
||||
public void setProgress(ProgressBar progress) {
|
||||
/** Establece el progressbar de un fragment **/
|
||||
((ActivityBase) getActivity()).setProgress(progress);
|
||||
}
|
||||
|
||||
public class OnClick implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
setClickActions(view.getId());
|
||||
}
|
||||
}
|
||||
|
||||
protected void setClickActions(int id) {}
|
||||
|
||||
public void execute(CommandBase cmd) {
|
||||
activity.execute(cmd);
|
||||
}
|
||||
|
||||
public void showProgress(boolean show) {
|
||||
if (show) {
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
contenedor.setVisibility(View.GONE);
|
||||
} else {
|
||||
progress.setVisibility(View.GONE);
|
||||
contenedor.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadArgs(Bundle args) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
activity.setFragmentActivo(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.nelosan.baselibrary.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.nelosan.baselibrary.R;
|
||||
|
||||
|
||||
public class FragmentCarga extends FragmentBase{
|
||||
|
||||
ProgressBar progressBar;
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.onAttach(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// TODO Auto-generated method stub
|
||||
View view = inflater.inflate(R.layout.fragment_carga, container, false);
|
||||
|
||||
progressBar = (ProgressBar)view.findViewById(R.id.progress_fragment_carga);
|
||||
setProgress(progressBar);
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package com.nelosan.baselibrary.model;
|
||||
|
||||
/**
|
||||
* Created by nelo on 15/06/15.
|
||||
*/
|
||||
public class CalendarItem {
|
||||
|
||||
private int day, month, year;
|
||||
private String value = "";
|
||||
private boolean click;
|
||||
private boolean selected = false;
|
||||
|
||||
public int getDay() {
|
||||
return day;
|
||||
}
|
||||
|
||||
public void setDay(int day) {
|
||||
this.day = day;
|
||||
}
|
||||
|
||||
public int getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(int month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public int getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear(int year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public boolean isClick() {
|
||||
return click;
|
||||
}
|
||||
|
||||
public void setClick(boolean click) {
|
||||
this.click = click;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean isSelected() {
|
||||
return selected;
|
||||
}
|
||||
|
||||
public void setSelected(boolean selected) {
|
||||
this.selected = selected;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.nelosan.baselibrary.model;
|
||||
|
||||
/**
|
||||
* Created by nelo on 31/03/15.
|
||||
*/
|
||||
public class ResultadoBusqueda {
|
||||
|
||||
private String Nombre;
|
||||
private String Url;
|
||||
private Object value;
|
||||
|
||||
public ResultadoBusqueda()
|
||||
{
|
||||
this.Nombre = "";
|
||||
this.Url = "";
|
||||
}
|
||||
|
||||
public String getNombre() {
|
||||
return Nombre;
|
||||
}
|
||||
|
||||
public void setNombre(String nombre) {
|
||||
Nombre = nombre;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return Url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
Url = url;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(Object value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package com.nelosan.baselibrary.toolbar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nelosan.baselibrary.ActivityBase;
|
||||
import com.nelosan.baselibrary.R;
|
||||
|
||||
|
||||
/**
|
||||
* Created by nelo on 26/03/15.
|
||||
*/
|
||||
public class ToolbarBuscar extends RelativeLayout {
|
||||
|
||||
private ActivityBase activity;
|
||||
private EditText edtTexto;
|
||||
private ImageView imgAtras;
|
||||
private View viewAnterior;
|
||||
private int color, darkColor;
|
||||
|
||||
public ToolbarBuscar(Context context) {
|
||||
super(context);
|
||||
LayoutInflater.from(context).inflate(R.layout.toolbar_buscar, this);
|
||||
activity = (ActivityBase)context;
|
||||
viewAnterior = activity.getToolbar().getChildAt(0);
|
||||
color = activity.getToolbarColor();
|
||||
darkColor = activity.getToolbarDarkColor();
|
||||
edtTexto = (EditText)findViewById(R.id.edittext_toolbar_buscar_texto);
|
||||
activity.abrirTeclado(edtTexto);
|
||||
edtTexto.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
|
||||
activity.cerrarTeclado(edtTexto);
|
||||
activity.buscar(edtTexto.getText().toString());
|
||||
activity.crearToolbar(viewAnterior, color, darkColor);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
edtTexto.addTextChangedListener(new TextWatcher() {
|
||||
|
||||
public void afterTextChanged(Editable s) {}
|
||||
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
activity.buscar(s.toString());
|
||||
}
|
||||
});
|
||||
imgAtras = (ImageView)findViewById(R.id.imageview_toolbar_buscar_atras);
|
||||
imgAtras.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
activity.cerrarTeclado(edtTexto);
|
||||
activity.crearToolbar(viewAnterior, color, darkColor);
|
||||
activity.buscar("");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package com.nelosan.baselibrary.toolbar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nelosan.baselibrary.ActivityBase;
|
||||
import com.nelosan.baselibrary.R;
|
||||
import com.nelosan.baselibrary.dialog.DialogBuscar;
|
||||
|
||||
|
||||
/**
|
||||
* Created by nelo on 26/03/15.
|
||||
*/
|
||||
public class ToolbarColores extends LinearLayout {
|
||||
|
||||
protected ActivityBase activity;
|
||||
protected TextView txtTitulo;
|
||||
protected ImageView imgBuscar;
|
||||
private String tipoBusqueda;
|
||||
private View separacion;
|
||||
public static final String BUSCAR_NORMAL = "buscar_normal";
|
||||
public static final String BUSCAR_DIALOG = "buscar_dialog";
|
||||
|
||||
public ToolbarColores(Context context, String titulo, boolean buscar) {
|
||||
super(context);
|
||||
LayoutInflater.from(context).inflate(R.layout.toolbar_colores, this);
|
||||
tipoBusqueda = BUSCAR_NORMAL;
|
||||
inicializar(context, titulo, buscar);
|
||||
}
|
||||
|
||||
public ToolbarColores(Context context, String titulo, boolean buscar, String tipo) {
|
||||
super(context);
|
||||
LayoutInflater.from(context).inflate(R.layout.toolbar_colores, this);
|
||||
tipoBusqueda = tipo;
|
||||
inicializar(context, titulo, buscar);
|
||||
}
|
||||
|
||||
private void inicializar(Context context, String titulo, boolean buscar)
|
||||
{
|
||||
activity = (ActivityBase)context;
|
||||
separacion = (View)findViewById(R.id.view_toolbar_colores_separacion);
|
||||
txtTitulo = (TextView)findViewById(R.id.textview_toolbar_colores_titulo);
|
||||
txtTitulo.setText(titulo);
|
||||
imgBuscar = (ImageView)findViewById(R.id.imageview_toolbar_colores_buscar);
|
||||
if(!buscar)
|
||||
imgBuscar.setVisibility(View.GONE);
|
||||
|
||||
imgBuscar.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
clickBuscar();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void clickBuscar()
|
||||
{
|
||||
if(tipoBusqueda.equals(BUSCAR_NORMAL))
|
||||
activity.crearToolbar(new ToolbarBuscar(activity), activity.getResources().getColor(R.color.blanco), activity.getResources().getColor(R.color.negro));
|
||||
else if(tipoBusqueda.equals(BUSCAR_DIALOG))
|
||||
{
|
||||
DialogBuscar dialog = new DialogBuscar(activity);
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
public void modificarToolbarcoloresClaros()
|
||||
{
|
||||
this.txtTitulo.setTextColor(activity.getResources().getColor(R.color.gris_buscar));
|
||||
this.imgBuscar.setImageDrawable(activity.getResources().getDrawable(R.drawable.ic_action_search_dark));
|
||||
}
|
||||
|
||||
public void setSeparacion(int visibilidad)
|
||||
{
|
||||
separacion.setVisibility(visibilidad);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<objectAnimator
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="400"
|
||||
android:propertyName="x"
|
||||
android:valueFrom="1000"
|
||||
android:valueTo="0"
|
||||
android:valueType="floatType"/>
|
||||
</set>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<objectAnimator
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="400"
|
||||
android:propertyName="x"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1000"
|
||||
android:valueType="floatType"/>
|
||||
|
||||
</set>
|
After Width: | Height: | Size: 351 B |
After Width: | Height: | Size: 599 B |
After Width: | Height: | Size: 585 B |
After Width: | Height: | Size: 599 B |
After Width: | Height: | Size: 802 B |
After Width: | Height: | Size: 650 B |
After Width: | Height: | Size: 702 B |
After Width: | Height: | Size: 315 B |
After Width: | Height: | Size: 402 B |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 438 B |
After Width: | Height: | Size: 608 B |
After Width: | Height: | Size: 449 B |
After Width: | Height: | Size: 479 B |
After Width: | Height: | Size: 468 B |
After Width: | Height: | Size: 745 B |
After Width: | Height: | Size: 727 B |
After Width: | Height: | Size: 744 B |
After Width: | Height: | Size: 1016 B |
After Width: | Height: | Size: 827 B |
After Width: | Height: | Size: 900 B |
After Width: | Height: | Size: 456 B |
After Width: | Height: | Size: 993 B |
After Width: | Height: | Size: 1021 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 518 B |
After Width: | Height: | Size: 522 B |
After Width: | Height: | Size: 219 B |
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/azul_claro" />
|
||||
<corners
|
||||
android:topLeftRadius="30dp"
|
||||
android:topRightRadius="30dp"
|
||||
android:bottomLeftRadius="30dp"
|
||||
android:bottomRightRadius="30dp"
|
||||
/>
|
||||
<size
|
||||
android:height="15dp"
|
||||
android:width="15dp"/>
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<androidx.drawerlayout.widget.DrawerLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/main_navigation_drawer"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/toolbar"/>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:foreground="@drawable/header_shadow">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/contenedor_izquierdo"
|
||||
android:orientation="vertical">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="2"
|
||||
android:id="@+id/contenedor"
|
||||
android:orientation="vertical">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/navigation_drawer_izquierda"/>
|
||||
<include layout="@layout/navigation_drawer_derecha"/>
|
||||
|
||||
</androidx.drawerlayout.widget.DrawerLayout >
|
|
@ -0,0 +1,26 @@
|
|||
<androidx.drawerlayout.widget.DrawerLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/main_navigation_drawer"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/toolbar"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/contenedor"
|
||||
android:orientation="vertical"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/navigation_drawer_izquierda"/>
|
||||
<include layout="@layout/navigation_drawer_derecha"/>
|
||||
|
||||
</androidx.drawerlayout.widget.DrawerLayout >
|
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/blanco">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/calendar_relative_cabecera"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/calendar_header"
|
||||
android:background="@color/blanco">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/calendar_imageview_previous_month"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/blanco"
|
||||
android:paddingLeft="@dimen/calendar_header_image_padding_left"
|
||||
android:paddingRight="@dimen/calendar_header_image_padding_right"
|
||||
android:src="@drawable/ic_action_previous_item"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:gravity="center_horizontal|center_vertical" />
|
||||
|
||||
|
||||
<com.nelosan.baselibrary.components.TextViewRoboto
|
||||
android:id="@+id/calendar_textview_cabecera"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_toLeftOf="@+id/calendar_imageview_next_month"
|
||||
android:layout_toRightOf="@+id/calendar_imageview_previous_month"
|
||||
android:gravity="center_horizontal|center_vertical"
|
||||
android:text=""
|
||||
android:textSize="@dimen/calendar_header_text_size"
|
||||
android:background="@color/blanco"/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/calendar_imageview_next_month"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/blanco"
|
||||
android:paddingLeft="@dimen/calendar_header_image_padding_left"
|
||||
android:paddingRight="@dimen/calendar_header_image_padding_right"
|
||||
android:src="@drawable/ic_action_next_item"
|
||||
android:layout_alignParentRight="true"
|
||||
android:gravity="center_horizontal|center_vertical" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/blanco"/>
|
||||
|
||||
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/calendar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="300dp"
|
||||
android:numColumns="7"
|
||||
android:background="@color/blanco"
|
||||
android:scrollbars="none"
|
||||
android:layout_below="@+id/calendar_relative_cabecera"
|
||||
android:stretchMode="columnWidth"
|
||||
android:verticalSpacing="1dp"
|
||||
android:horizontalSpacing="1dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/blanco"
|
||||
>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageview_dialog_buscar_atras"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_action_back"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageview_dialog_buscar_icono"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_action_mic"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="10dp"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edittext_dialog_buscar_busqueda"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_toLeftOf="@+id/imageview_dialog_buscar_icono"
|
||||
android:layout_toRightOf="@+id/imageview_dialog_buscar_atras"
|
||||
android:background="@color/blanco"
|
||||
android:padding="10dp"
|
||||
android:imeOptions="actionSearch"
|
||||
android:singleLine="true"
|
||||
android:hint="@string/buscar"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/gris"/>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/listview_dialog_buscar_resultados"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="none"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_fragment_carga"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:foreground="@drawable/header_shadow" />
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/linear_item_calendar_dia"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="@dimen/padding"
|
||||
android:paddingBottom="@dimen/padding"
|
||||
android:background="@color/blanco">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview_item_calendar_dia"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="1"
|
||||
android:textSize="@dimen/calendar_item_text_size"
|
||||
android:background="@color/blanco"
|
||||
android:maxLines="1"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageview_item_resultado_buscar_foto"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/ic_action_replay"/>
|
||||
|
||||
<com.nelosan.baselibrary.components.TextViewRoboto
|
||||
android:id="@+id/textview_item_resultado_buscar_texto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_toRightOf="@id/imageview_item_resultado_buscar_foto"
|
||||
android:textSize="16sp"
|
||||
android:text=""
|
||||
android:gravity="center_vertical"
|
||||
android:padding="10dp"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/contenido_navigation_drawer_derecha"
|
||||
android:layout_gravity="end"
|
||||
android:background="#fff"
|
||||
android:orientation="vertical"
|
||||
android:clickable="true">
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="300dp"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/contenido_navigation_drawer_izquierda"
|
||||
android:layout_gravity="start"
|
||||
android:background="#fff"
|
||||
android:clickable="true">
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
android:popupTheme="@style/ThemeOverlay.AppCompat.Light">
|
||||
|
||||
|
||||
|
||||
</androidx.appcompat.widget.Toolbar>
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:background="@color/blanco">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageview_toolbar_buscar_atras"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/ic_action_back"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:background="@color/blanco"
|
||||
/>
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edittext_toolbar_buscar_texto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/blanco"
|
||||
android:layout_toRightOf="@+id/imageview_toolbar_buscar_atras"
|
||||
android:hint="@string/buscar"
|
||||
android:paddingLeft="10dp"
|
||||
android:imeOptions="actionSearch"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/gris"
|
||||
android:layout_alignParentBottom="true"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:orientation="vertical"
|
||||
android:elevation="4dp">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:foreground="@drawable/header_shadow">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/relativelayout_toolbar_colores_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview_toolbar_colores_titulo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:textColor="@color/blanco"
|
||||
android:text=""
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="24sp"
|
||||
android:paddingLeft="15dp"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageview_toolbar_colores_buscar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_action_search"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginLeft="10dp"/>
|
||||
|
||||
|
||||
|
||||
<View
|
||||
android:id="@+id/view_toolbar_colores_separacion"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/gris"
|
||||
android:visibility="gone"
|
||||
android:layout_alignParentBottom="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="no_internet">No hi ha conexió a internet</string>
|
||||
<string name="aceptar">Aceptar</string>
|
||||
<string name="retry">Reintentar</string>
|
||||
<string name="aviso">Avís</string>
|
||||
<string name="buscar">Buscar</string>
|
||||
|
||||
<!-- Dates -->
|
||||
<string name="monday">dilluns</string>
|
||||
<string name="tuesday">dimarts</string>
|
||||
<string name="wednesday">dimecres</string>
|
||||
<string name="thursday">dijous</string>
|
||||
<string name="friday">divendres</string>
|
||||
<string name="saturday">dissabte</string>
|
||||
<string name="sunday">diumenge</string>
|
||||
|
||||
<string name="calendar_monday">dil.</string>
|
||||
<string name="calendar_tuesday">dim.</string>
|
||||
<string name="calendar_wednesday">dix.</string>
|
||||
<string name="calendar_thursday">dij.</string>
|
||||
<string name="calendar_friday">div.</string>
|
||||
<string name="calendar_saturday">dis.</string>
|
||||
<string name="calendar_sunday">diu.</string>
|
||||
|
||||
<string name="calendar_january">gen.</string>
|
||||
<string name="calendar_february">feb.</string>
|
||||
<string name="calendar_march">mar.</string>
|
||||
<string name="calendar_april">abr.</string>
|
||||
<string name="calendar_may">mai.</string>
|
||||
<string name="calendar_june">jun.</string>
|
||||
<string name="calendar_july">jul.</string>
|
||||
<string name="calendar_august">ago.</string>
|
||||
<string name="calendar_september">set.</string>
|
||||
<string name="calendar_october">oct.</string>
|
||||
<string name="calendar_november">nov.</string>
|
||||
<string name="calendar_december">dec.</string>
|
||||
|
||||
<string name="january">Gener</string>
|
||||
<string name="february">Febrer</string>
|
||||
<string name="march">Març</string>
|
||||
<string name="april">Abril</string>
|
||||
<string name="may">Maig</string>
|
||||
<string name="june">Juny</string>
|
||||
<string name="july">Juliol</string>
|
||||
<string name="august">Agost</string>
|
||||
<string name="september">Setembre</string>
|
||||
<string name="october">Octubre</string>
|
||||
<string name="november">Novembre</string>
|
||||
<string name="december">Decembre</string>
|
||||
|
||||
</resources>
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="no_internet">No hay conexión a internet</string>
|
||||
<string name="aceptar">Aceptar</string>
|
||||
<string name="retry">Reintentar</string>
|
||||
<string name="aviso">Aviso</string>
|
||||
<string name="buscar">Buscar</string>
|
||||
|
||||
<!-- Dates -->
|
||||
<string name="monday">lunes</string>
|
||||
<string name="tuesday">martes</string>
|
||||
<string name="wednesday">miercoles</string>
|
||||
<string name="thursday">jueves</string>
|
||||
<string name="friday">viernes</string>
|
||||
<string name="saturday">sabado</string>
|
||||
<string name="sunday">domingo</string>
|
||||
|
||||
<string name="calendar_monday">lun.</string>
|
||||
<string name="calendar_tuesday">mar.</string>
|
||||
<string name="calendar_wednesday">mie.</string>
|
||||
<string name="calendar_thursday">jue.</string>
|
||||
<string name="calendar_friday">vie.</string>
|
||||
<string name="calendar_saturday">sab.</string>
|
||||
<string name="calendar_sunday">dom.</string>
|
||||
|
||||
<string name="calendar_january">ene.</string>
|
||||
<string name="calendar_february">feb.</string>
|
||||
<string name="calendar_march">mar.</string>
|
||||
<string name="calendar_april">abr.</string>
|
||||
<string name="calendar_may">may.</string>
|
||||
<string name="calendar_june">jun.</string>
|
||||
<string name="calendar_july">jul.</string>
|
||||
<string name="calendar_august">ago.</string>
|
||||
<string name="calendar_september">sep.</string>
|
||||
<string name="calendar_october">oct.</string>
|
||||
<string name="calendar_november">nov.</string>
|
||||
<string name="calendar_december">dec.</string>
|
||||
|
||||
<string name="january">Enero</string>
|
||||
<string name="february">Febrero</string>
|
||||
<string name="march">Marzo</string>
|
||||
<string name="april">Abril</string>
|
||||
<string name="may">Mayo</string>
|
||||
<string name="june">Junio</string>
|
||||
<string name="july">Julio</string>
|
||||
<string name="august">Agosto</string>
|
||||
<string name="september">Septiembre</string>
|
||||
<string name="october">Octubre</string>
|
||||
<string name="november">Noviembre</string>
|
||||
<string name="december">Diciembre</string>
|
||||
|
||||
</resources>
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="no_internet">Não há conexão com internet</string>
|
||||
<string name="aceptar">Aceitar</string>
|
||||
<string name="retry">Repetir</string>
|
||||
<string name="aviso">Aviso</string>
|
||||
<string name="buscar">Buscar</string>
|
||||
|
||||
<!-- Dates -->
|
||||
<string name="monday">Segunda-Feira</string>
|
||||
<string name="tuesday">Terça-Feira</string>
|
||||
<string name="wednesday">Quarta-Feira</string>
|
||||
<string name="thursday">Quinta-Feira</string>
|
||||
<string name="friday">Sexta-Feira</string>
|
||||
<string name="saturday">Sabado</string>
|
||||
<string name="sunday">Domingo</string>
|
||||
|
||||
<string name="calendar_monday">seg.</string>
|
||||
<string name="calendar_tuesday">ter.</string>
|
||||
<string name="calendar_wednesday">qua.</string>
|
||||
<string name="calendar_thursday">qui.</string>
|
||||
<string name="calendar_friday">sex.</string>
|
||||
<string name="calendar_saturday">sab.</string>
|
||||
<string name="calendar_sunday">dom.</string>
|
||||
|
||||
<string name="calendar_january">jan.</string>
|
||||
<string name="calendar_february">fev.</string>
|
||||
<string name="calendar_march">mar.</string>
|
||||
<string name="calendar_april">abr.</string>
|
||||
<string name="calendar_may">mai.</string>
|
||||
<string name="calendar_june">jun.</string>
|
||||
<string name="calendar_july">jul.</string>
|
||||
<string name="calendar_august">ago.</string>
|
||||
<string name="calendar_september">set.</string>
|
||||
<string name="calendar_october">out.</string>
|
||||
<string name="calendar_november">nov.</string>
|
||||
<string name="calendar_december">dez.</string>
|
||||
|
||||
<string name="january">Janeiro</string>
|
||||
<string name="february">Fevereiro</string>
|
||||
<string name="march">Março</string>
|
||||
<string name="april">Abril</string>
|
||||
<string name="may">Maio</string>
|
||||
<string name="june">Junho</string>
|
||||
<string name="july">Julho</string>
|
||||
<string name="august">Agosto</string>
|
||||
<string name="september">Setembro</string>
|
||||
<string name="october">Outubro</string>
|
||||
<string name="november">Novembro</string>
|
||||
<string name="december">Dezembro</string>
|
||||
|
||||
</resources>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<item name="header_shadow" type="drawable">@null</item>
|
||||
</resources>
|