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)
Introducción a HMS Core
Pasos para el desarrollo de aplicaciones con Huawei
Debugging en la nube con Huawei
¿Qué es HMS Core?
Creación del proyecto en Android Studio
Creación de la aplicación en App Gallery Connect
Configuración de firma SHA-256
Configuración de APIs
Configuración de Android Studio y Gradle
Probando la sincronización de la aplicación
Autenticación con HMS Account Kit
Diseñando nuestra pantalla de login
Agregando los métodos de autenticación
Verificando la autenticación
Agregando el método de logout
Construyendo nuestra cámara de selfies con HMS ML Kit
Machine Learning con Huawei
Agregando los permisos para acceder a la cámara
Diseñando la pantalla personalizada de la cámara
Creando la capa de gráficos de la cámara
Creando el layout para nuestro rostro
Creando el layout del lente de la cámara
Creando nuestra actividad de cámara
Agregando nuestra cámara personalizada a la actividad
Agregando los métodos de verificación de rostro
Agregando la detección de rostro y sonrisa individual
Agregando la detección de rostro y sonrisa grupal
Tomar nuestra imagen y agregar un método de re-toma de foto
Guardar la foto en nuestra galeria
Aplicando notificaciones push con HMS Push kit
Crear el servicio de push notifications
Agregar el servicio de HMS Push kit
Verificar la conectividad de las notificaciones en App Gallery Connect
Conclusiones y consejos
Tips y solución de inconvenientes frecuentes
¿Qué más tiene Huawei?
You don't have access to this class
Keep learning! Join and start boosting your career
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.
The first thing in our customization task is to create two fundamental packages:
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...}
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}
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...}
This is crucial for the correct proportion of the overlay:
var scaleX: Float = 1.0f private setvarscaleY: Float = 1.0f private set
private
, which allows controlled access.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() { ... }
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
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
Want to see more contributions, questions and answers from the community?