diff --git "a/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.gitignore" "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.gitignore" new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.gitignore" @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git "a/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.idea/.gitignore" "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.idea/.gitignore" new file mode 100644 index 0000000..26d3352 --- /dev/null +++ "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.idea/.gitignore" @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git "a/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.idea/.name" "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.idea/.name" new file mode 100644 index 0000000..b3405b3 --- /dev/null +++ "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.idea/.name" @@ -0,0 +1 @@ +My Application \ No newline at end of file diff --git "a/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.idea/compiler.xml" "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.idea/compiler.xml" new file mode 100644 index 0000000..61a9130 --- /dev/null +++ "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.idea/compiler.xml" @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git "a/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.idea/gradle.xml" "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.idea/gradle.xml" new file mode 100644 index 0000000..23a89bb --- /dev/null +++ "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.idea/gradle.xml" @@ -0,0 +1,22 @@ + + + + + + + \ No newline at end of file diff --git "a/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.idea/jarRepositories.xml" "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.idea/jarRepositories.xml" new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.idea/jarRepositories.xml" @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git "a/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.idea/misc.xml" "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.idea/misc.xml" new file mode 100644 index 0000000..d5d35ec --- /dev/null +++ "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/.idea/misc.xml" @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git "a/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/README.md" "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/README.md" new file mode 100644 index 0000000..09970bf --- /dev/null +++ "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/README.md" @@ -0,0 +1,30 @@ +## :eyes: CONSTRUCCIÓN DE UNA APLICACIÓN EN ANDROID STUDIO :eyes: + +Este README contiene información básica referente al funcionamiento de una sencilla aplicación desarrollada en AndroidStudio, +bajo el lenguaje de programación Kotlin. :heart: + +### Concepto Básico :smiley: + +Utilizar la capacidad de AndroidStudio y sus APIS para obtener el control y uso de la cámara, logrando que el usuario tome una +fotografía y se muestre en la misma pantalla, después de tomarla. + +### Funcionamiento :new_moon_with_face: + +Haciendo uso de un botón y de algo de código, podemos activar la cámara al presionar dicho botón, lo que nos permitirá tomar una +foto; si nos gusta, podremos mostrarla en el dispositivo, de lo contrario, tomar otra hasta que sea de nuestro agrado. +En un principio se muestra el botón en la parte superior, acompañado de un ImageView "Dummie" que será reemplazado posteriormente +con la foto que nostros eligamos poner, como se muestra a continuación. + +

+Vista 1 +

+ +Aquí podemos apreciar la imagen dummie que será reemplazada por la foto que tomemos. A continuación se muestra como la foto tomada +por la cámara remplaza el dummie, y el botón permitirá tomar otra foto, si así se desea. + +

+ Vista 2 + +### Miembros +#### Calderón Guevara César Yair 🚷 +#### Olazábal Baquero Omar Armando 💫 diff --git "a/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/.gitignore" "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/.gitignore" new file mode 100644 index 0000000..42afabf --- /dev/null +++ "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/.gitignore" @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git "a/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/build.gradle" "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/build.gradle" new file mode 100644 index 0000000..384b788 --- /dev/null +++ "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/build.gradle" @@ -0,0 +1,45 @@ +plugins { + id 'com.android.application' + id 'kotlin-android' +} + +android { + compileSdkVersion 30 + buildToolsVersion "30.0.3" + + defaultConfig { + applicationId "com.example.myapplication" + minSdkVersion 16 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } +} +apply plugin: 'kotlin-android-extensions' +dependencies { + + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'androidx.core:core-ktx:1.2.0' + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'com.google.android.material:material:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' +} \ No newline at end of file diff --git "a/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/proguard-rules.pro" "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/proguard-rules.pro" new file mode 100644 index 0000000..481bb43 --- /dev/null +++ "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/proguard-rules.pro" @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git "a/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.kt" "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.kt" new file mode 100644 index 0000000..e9283cf --- /dev/null +++ "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.kt" @@ -0,0 +1,24 @@ +package com.example.myapplication + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.example.myapplication", appContext.packageName) + } +} \ No newline at end of file diff --git "a/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/src/main/AndroidManifest.xml" "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/src/main/AndroidManifest.xml" new file mode 100644 index 0000000..0fd8c95 --- /dev/null +++ "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/src/main/AndroidManifest.xml" @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/src/main/java/com/example/myapplication/MainActivity.kt" "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/src/main/java/com/example/myapplication/MainActivity.kt" new file mode 100644 index 0000000..e7ff134 --- /dev/null +++ "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/src/main/java/com/example/myapplication/MainActivity.kt" @@ -0,0 +1,53 @@ +package com.example.myapplication + +import android.app.Activity +import android.content.Intent +import android.graphics.Bitmap +import android.graphics.BitmapFactory +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.os.Environment +import android.provider.MediaStore +import android.widget.Button +import android.widget.Toast +import androidx.core.content.FileProvider +import kotlinx.android.synthetic.main.activity_main.* +import java.io.File + +private const val FILE_NAME = "photo.jpg" +private const val REQUEST_CODE = 1 +private lateinit var photoFile: File +class MainActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + + btnTomarFoto.setOnClickListener { + val tomarFotoIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE) + photoFile = obtenerArchivoFoto(FILE_NAME) + + val proveedorFoto = FileProvider.getUriForFile(this, "com.example.fileprovider", photoFile) + tomarFotoIntent.putExtra(MediaStore.EXTRA_OUTPUT, proveedorFoto) + if(tomarFotoIntent.resolveActivity(this.packageManager) != null) { + startActivityForResult(tomarFotoIntent, REQUEST_CODE) + }else{ + Toast.makeText(this, "No es posible abrir la cámara", Toast.LENGTH_SHORT).show() + } + } + } + + private fun obtenerArchivoFoto(fileName: String):File{ //Funcion para obtener la foto en mejor calidad + val directorioAlmacenamiento = getExternalFilesDir(Environment.DIRECTORY_PICTURES) + return File.createTempFile(fileName, ".jpg", directorioAlmacenamiento) + } + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + if(requestCode == REQUEST_CODE && resultCode == Activity.RESULT_OK){ //Si esto es TRUE, el usuario logro tomar la foto + //val imagenTomada = data?.extras?.get("data") as Bitmap//data y extras son nullables, llevan '?' + val imagenTomada = BitmapFactory.decodeFile(photoFile.absolutePath) + imageView.setImageBitmap(imagenTomada) //Colocamos la foto tomada en el imageView + }else { + super.onActivityResult(requestCode, resultCode, data) + } + } +} diff --git "a/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git "a/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/src/main/res/drawable/ic_launcher_background.xml" "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/src/main/res/drawable/ic_launcher_background.xml" new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/src/main/res/drawable/ic_launcher_background.xml" @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git "a/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/src/main/res/layout/activity_main.xml" "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/src/main/res/layout/activity_main.xml" new file mode 100644 index 0000000..26c5078 --- /dev/null +++ "b/Proyectos/Olaz\303\241bal Baquero Omar Armando y Calder\303\263n Guevara Cesar Yair/app/src/main/res/layout/activity_main.xml" @@ -0,0 +1,31 @@ + + + + +