Introducción a HMS Core

1

Pasos para el desarrollo de aplicaciones con Huawei

2

Debugging en la nube con Huawei

3

¿Qué es HMS Core?

4

Creación del proyecto en Android Studio

5

Creación de la aplicación en App Gallery Connect

6

Configuración de firma SHA-256

7

Configuración de APIs

8

Configuración de Android Studio y Gradle

9

Probando la sincronización de la aplicación

Autenticación con HMS Account Kit

10

Diseñando nuestra pantalla de login

11

Agregando los métodos de autenticación

12

Verificando la autenticación

13

Agregando el método de logout

Construyendo nuestra cámara de selfies con HMS ML Kit

14

Machine Learning con Huawei

15

Agregando los permisos para acceder a la cámara

16

Diseñando la pantalla personalizada de la cámara

17

Creando la capa de gráficos de la cámara

18

Creando el layout para nuestro rostro

19

Creando el layout del lente de la cámara

20

Creando nuestra actividad de cámara

21

Agregando nuestra cámara personalizada a la actividad

22

Agregando los métodos de verificación de rostro

23

Agregando la detección de rostro y sonrisa individual

24

Agregando la detección de rostro y sonrisa grupal

25

Tomar nuestra imagen y agregar un método de re-toma de foto

26

Guardar la foto en nuestra galeria

Aplicando notificaciones push con HMS Push kit

27

Crear el servicio de push notifications

28

Agregar el servicio de HMS Push kit

29

Verificar la conectividad de las notificaciones en App Gallery Connect

Conclusiones y consejos

30

Tips y solución de inconvenientes frecuentes

31

¿Qué más tiene Huawei?

You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesión a prueba de IA

Antes: $249

Currency
$209
Suscríbete

Termina en:

2 Días
13 Hrs
3 Min
10 Seg

Diseñando la pantalla personalizada de la cámara

16/31
Resources

How to configure camera customization?

To achieve ideal functionality in camera applications, it is vital that developers know how to customize their settings. Here I explain how to implement such customization, working with packages, classes and essential variables that will allow you to design a dynamic and efficient camera.

What packages do we need?

The first thing in our customization task is to create two fundamental packages:

  1. Camera: This package will contain the class for the configuration of our camera.
  2. Overlay: Here we will configure the overlay or graphic layer necessary for the visualization.

How to configure the camera variables?

In the CameraConfiguration class, we define how we want our camera to work:

class CameraConfiguration { var FPS: Int = 20 var previewHeight: Int? = null var isAutoFocus: Boolean = true...}
  • FPS: Sets the frames per second, critical for video smoothness.
  • previewHeight: The height of the camera viewfinder.
  • isAutoFocus: Defines whether the camera will use autofocus, set to true at startup.

Which functions should we synchronize?

It is essential that some operations are synchronized, since the camera operates in real time and delays can cause problems:

synchronized fun setCameraFasing(required: Int) { if (facing != CAMERA_FACING_BACK && facing ! = CAMERA_FACING_FRONT) { throw IllegalArgumentException("Invalid camera") } this.facing = required}
  • setCameraFasing: Ensures that the camera facing change is instantaneous and error-free.

How do we create the camera overlay?

One part of the camera configuration is the GraphicOverlay, the graphic layer we use to handle visual elements:

class GraphicOverlay(context: Context, attrs: AttributeSet?) : View(context, attrs) { private var lock: Any = Any() private var previewWidth: Int = 0 private var previewHeight: Int = 0...}
  • Lock: To lock processes when the photo is hacked.
  • previewWidth and previewHeight: Width and height of the preview, both initialized to zero.

How to set the scale values?

This is crucial for the correct proportion of the overlay:

var scaleX: Float = 1.0f private setvarscaleY: Float = 1.0f private set
  • scaleX and scaleY: Both must be private, which allows controlled access.

What additional functions should we implement?

Finally, we add functions to handle graphics:

synchronized fun setCameraInfo(width: Int, height: Int, facing: Int) { previewWidth = width previewHeight = height this.facing = facing postInvalidate()}fun addGraphics(graphic: Graphic) { ... }fun clear() { ... }
  1. setCameraInfo: Receives and synchronizes the width, height and direction of the camera.
  2. addGraphics and clear: These are methods to manage graphics, essential in most interactive projects.

This comprehensive approach customizes camera functionality while ensuring that critical processes are managed efficiently. Now, you have the tools and knowledge to create a camera application with customized settings that meet your needs and those of your users. Take heart and keep learning!

Contributions 2

Questions 0

Sort by:

Want to see more contributions, questions and answers from the community?

La forma correcta de heredar de una clase View (en kotlin) es definiendo los 3 constructores como se explica en [https://medium.com/@mmlodawski/https-medium-com-mmlodawski-do-not-always-trust-jvmoverloads-5251f1ad2cfe](esta publicacion)

Las clases en Kotlin son por defecto declaradas como finales, por tanto no se puede heredar de ellas, con open hacemos que una clase pueda ser heredada por otra

https://www.desarrollolibre.net/blog/android/clases-en-kotlin-herencia-implementacion-abstractas-y-abiertas-open#.XzNXPZP0kWo