forked from beduExpert/Android-Avanzado-MASIVO-2021
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit acd4f55
Showing
877 changed files
with
24,676 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Android Avanzado | ||
|
||
## :wave: Bienvenid@s | ||
|
||
## :dart: Objetivo | ||
|
||
Construir una aplicación Android con funciones inyectadas por dependencias y librerías, con simplificación de autenticación, reporte y seguimiento de errores, servicios de terceros, elementos de realidad aumentada, y publicable en tiendas alternativas a Google Play y/o en un servidor propio. | ||
|
||
## Datos relevantes | ||
|
||
- Firebase es una plataforma de Google para desarrollar y facilitar la creación de apps con alta calidad de una forma rápida. | ||
- ArCore es un kit de desarrollo de software para dispositivos móviles que permite la creación de aplicaciones de realidad aumentada. | ||
- Jetpack es un conjunto de bibliotecas que ayuda a los desarrolladores a seguir las prácticas recomendadas, reducir el código estándar y escribir código que funcione de manera coherente en los dispositivos y las versiones de Android, para que puedan enfocarse en el código que les interesa. | ||
|
||
## :gear: Requerimientos | ||
|
||
- Android Studio | ||
- Cuenta de Google | ||
- Teléfono físico (Recomendado) | ||
- SDK ArCore | ||
|
||
## 💻 Proyecto | ||
|
||
Desarrollar una app Android con Kotlin como principal lenguaje de desarrollo, con funciones agregadas mediante Firebase Authentication, Firebase Crashlytics, Dependencias, Navigation, SDK´s, Deploys, Librerías y RA. | ||
|
||
## :bookmark_tabs: Sesiones | ||
|
||
1. [Firebase Authentication ](./Sesion-01)(Simplifica el inicio de sesión y el registro) | ||
2. [Firebase Crashlytics ](./Sesion-02)(Reportes y seguimiento a errores) | ||
3. [Dependencias ](./Sesion-03)(Simplifica el código) | ||
4. [Navigation ](./Sesion-04)(Mejora el flujo de datos) | ||
5. [Terceros ](./Sesion-05)(Implementar SDK's de terceros) Facebook, Spotify, Conekta | ||
6. [Deploys ](./Sesion-06)(Publica en tiendas altenativas a Google Play o en un servidor externo) | ||
7. [Librerías ](./Sesion-07)(Ahorra código y mejora el flujo) | ||
8. [RA ](./Sesion-08)(Implementaciones más utilizadas de RA) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Ejemplo 01: Implementar Firebase Authentication | ||
|
||
## Objetivo | ||
|
||
* Implementar y configurar Firebase Authentication en un proyecto base. | ||
|
||
## Desarrollo | ||
|
||
A partir de un proyecto de Android previamente creado se implementará el BaaS de Firebase Authentication para integrar sus servicios de registro e inicio de sesión. | ||
|
||
Usaremos el [Proyecto base](./base) y le modificaremos lo que se requiera. Para hacerlo realiza los siguientes pasos: | ||
|
||
1. Ejecutamos el proyecto base con Android Studio. Este desplegará la siguiente interfaz. | ||
|
||
|
||
<img src="assets/01.png" width="50%"/> | ||
|
||
2. Ahora, agregaremos las librerías de Firebase. Para ello hacemos clic en la siguiente ruta: **Tools -> Firebase** | ||
|
||
<img src="assets/02.png" width="50%"/> | ||
|
||
3. El resultado será la siguiente ventana. Es necesario identificar la opción de Authentication, hacer clic en ella, y después hacer clic en la tercera opción, enlistada como **Authentication using a custom authentication system**. | ||
|
||
<img src="assets/03.png" width="60%"/> | ||
|
||
4. Aparecerá la siguiente ventana. Se debe hacer clic en **Connect to Firebase**. | ||
|
||
<img src="assets/04.png" width="60%"/> | ||
|
||
<img src="assets/05.png" width="60%"/> | ||
|
||
5. El resultado del botón abrirá el navegador. En la siguiente ventana debe seleccionarse el proyecto (el cual denominamos Bedu), y posteriormente es necesario hacer clic en **Conectar**. | ||
|
||
<img src="assets/06.png" width="60%"/> | ||
|
||
6. Listo, hasta este paso la app ya se encuentra conectada a Firebase. | ||
|
||
<img src="assets/07.png" width="70%"/> | ||
|
||
7. Ahora debe seguirse la ruta hasta el paso 3. Ahí debe seleccionarse **Add the Firebase Authentication SDK to your app** y luego se aceptan los cambios. | ||
|
||
<img src="assets/08.png" width="60%"/> | ||
|
||
Esto Agrega *Play Services y Auth* | ||
|
||
<img src="assets/09.png" width="60%"/> | ||
|
||
8. Ahora debemos dirigirnos a Firebase Console y activar **Authentication**. | ||
|
||
<img src="assets/10.png" width="60%"/> | ||
|
||
|
||
|
||
¡Felicidades! Ya implementaste Firebase Authentication en tu proyecto Android. | ||
|
||
</br> | ||
|
||
[Siguiente ](../Ejemplo-02/README.md)(Ejemplo 2) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
## Aquí puedes sustituir este archivo por imagenes o código que requiera el ejemplo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
plugins { | ||
id 'com.android.application' | ||
id 'kotlin-android' | ||
} | ||
|
||
android { | ||
compileSdkVersion 30 | ||
buildToolsVersion "30.0.3" | ||
|
||
defaultConfig { | ||
applicationId "com.bedu.auth" | ||
minSdkVersion 19 | ||
targetSdkVersion 30 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
buildFeatures { | ||
viewBinding true | ||
} | ||
kotlinOptions { | ||
jvmTarget = '1.8' | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | ||
implementation 'androidx.core:core-ktx:1.5.0' | ||
implementation 'androidx.appcompat:appcompat:1.3.0' | ||
implementation 'com.google.android.material:material:1.3.0' | ||
|
||
testImplementation 'junit:junit:4.13.2' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.2' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
24 changes: 24 additions & 0 deletions
24
Sesion-01/Ejemplo-01/base/app/src/androidTest/java/com/bedu/auth/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.bedu.auth | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | ||
assertEquals("com.bedu.auth", appContext.packageName) | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Sesion-01/Ejemplo-01/base/app/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.bedu.auth"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.Auth"> | ||
|
||
<activity android:name=".view.MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
|
||
</activity> | ||
|
||
<activity android:name=".view.EmailActivity" /> | ||
<activity android:name=".view.PhoneActivity" /> | ||
|
||
</application> | ||
|
||
</manifest> |
33 changes: 33 additions & 0 deletions
33
Sesion-01/Ejemplo-01/base/app/src/main/java/com/bedu/auth/utils/Utility.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.bedu.auth.utils | ||
|
||
import android.content.Context | ||
import android.view.View | ||
import android.view.inputmethod.InputMethodManager | ||
import androidx.annotation.ColorInt | ||
import androidx.annotation.ColorRes | ||
import androidx.core.content.ContextCompat | ||
import com.bedu.auth.R | ||
import com.google.android.material.snackbar.Snackbar | ||
|
||
object Utility { | ||
|
||
//display SnackBar | ||
fun displaySnackBar(view: View, s: String, context: Context, @ColorRes colorRes: Int) { | ||
|
||
Snackbar.make(view, s, Snackbar.LENGTH_LONG) | ||
.withColor(ContextCompat.getColor(context, colorRes)) | ||
.setTextColor(ContextCompat.getColor(context, R.color.white)) | ||
.show() | ||
|
||
} | ||
|
||
fun View.hideKeyboard() { | ||
val inputManager = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | ||
inputManager.hideSoftInputFromWindow(windowToken, 0) | ||
} | ||
|
||
private fun Snackbar.withColor(@ColorInt colorInt: Int): Snackbar { | ||
this.view.setBackgroundColor(colorInt) | ||
return this | ||
} | ||
} |
92 changes: 92 additions & 0 deletions
92
Sesion-01/Ejemplo-01/base/app/src/main/java/com/bedu/auth/view/EmailActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package com.bedu.auth.view | ||
|
||
import android.app.Activity | ||
import android.os.Bundle | ||
import android.os.Handler | ||
import android.os.Looper | ||
import android.view.View | ||
import androidx.core.widget.doAfterTextChanged | ||
import com.bedu.auth.databinding.ActivityEmailBinding | ||
import com.bedu.auth.utils.Utility.hideKeyboard | ||
|
||
class EmailActivity : Activity() { | ||
|
||
private lateinit var binding: ActivityEmailBinding | ||
|
||
public override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = ActivityEmailBinding.inflate(layoutInflater) | ||
val view = binding.root | ||
setContentView(view) | ||
|
||
handleClick() | ||
} | ||
|
||
private fun handleClick() { | ||
|
||
binding.btnLogin.setOnClickListener { | ||
it.hideKeyboard() | ||
|
||
binding.btnLogin.visibility = View.GONE | ||
binding.loading.visibility = View.VISIBLE | ||
|
||
val email = binding.editText.text.toString() | ||
val password = binding.editText2.text.toString() | ||
|
||
signIn(email, password) | ||
} | ||
binding.btnRegister.setOnClickListener { | ||
it.hideKeyboard() | ||
|
||
binding.btnLogin.visibility = View.GONE | ||
binding.loading.visibility = View.VISIBLE | ||
|
||
val email = binding.editText.text.toString() | ||
val password = binding.editText2.text.toString() | ||
|
||
createAccount(email, password) | ||
} | ||
|
||
binding.editText.doAfterTextChanged { | ||
val email = binding.editText.text.toString() | ||
val password = binding.editText2.text.toString() | ||
|
||
binding.btnLogin.isEnabled = email.isNotEmpty() && password.isNotEmpty() | ||
binding.btnRegister.isEnabled = email.isNotEmpty() && password.isNotEmpty() | ||
} | ||
|
||
binding.editText2.doAfterTextChanged { | ||
val email = binding.editText.text.toString() | ||
val password = binding.editText2.text.toString() | ||
|
||
binding.btnLogin.isEnabled = email.isNotEmpty() && password.isNotEmpty() | ||
binding.btnRegister.isEnabled = email.isNotEmpty() && password.isNotEmpty() | ||
} | ||
} | ||
|
||
private fun createAccount(email: String, password: String) { | ||
updateUI() | ||
} | ||
|
||
private fun signIn(email: String, password: String) { | ||
updateUI() | ||
} | ||
|
||
private fun sendEmailVerification() { | ||
} | ||
|
||
private fun updateUI() { | ||
Handler(Looper.getMainLooper()).postDelayed({ | ||
binding.loading.visibility = View.GONE | ||
binding.btnLogin.visibility = View.VISIBLE | ||
}, 2000) | ||
} | ||
|
||
private fun reload() { | ||
|
||
} | ||
|
||
companion object { | ||
private const val TAG = "EmailPassword" | ||
} | ||
} |
Oops, something went wrong.