Skip to content

Instantly share code, notes, and snippets.

@MiguelXCruz
Created May 23, 2022 14:33
Show Gist options
  • Save MiguelXCruz/0791e125bbbcc94c081f5d3149a12655 to your computer and use it in GitHub Desktop.
Save MiguelXCruz/0791e125bbbcc94c081f5d3149a12655 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<import type="android.view.View"/>
<variable
name="viewModel"
type="com.combateafraude.passivefaceliveness.controller.viewmodel.SDKViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:keepScreenOn="true">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guidelineStart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.1" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guidelineEnd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.9" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guidelineTop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.05" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guidelineStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.7" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guidelineBottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.97" />
<androidx.camera.view.PreviewView
android:id="@id/cameraImageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="@{viewModel.cameraVisibility ? View.VISIBLE : View.GONE}"
>
</androidx.camera.view.PreviewView>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@{viewModel.previewBitMap}"
android:visibility="@{viewModel.previewVisibility ? View.VISIBLE : View.GONE}">
</ImageView>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:contentDescription="@string/photo_mask_caf"
android:scaleType="fitXY"
android:src="@{context.getDrawable(viewModel.maskLayout)}"
android:visibility="@{viewModel.maskVisibility ? View.VISIBLE : View.GONE}" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:adjustViewBounds="true"
android:contentDescription="@string/close_caf"
android:onClick="@{() -> viewModel.close()}"
android:src="@drawable/ic_back_caf"
app:layout_constraintStart_toStartOf="@id/guidelineStart"
app:layout_constraintTop_toTopOf="@id/guidelineTop" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:adjustViewBounds="true"
android:contentDescription="@string/switch_camera"
android:onClick="@{() -> viewModel.switchCamera()}"
android:src="@drawable/ic_camera_switch"
android:visibility="@{viewModel.switchCameraButtonVisibility ? View.VISIBLE : View.GONE}"
app:layout_constraintEnd_toEndOf="@id/guidelineEnd"
app:layout_constraintTop_toTopOf="@id/guidelineTop" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:visibility="@{viewModel.manualCaptureButtonVisibility ? View.VISIBLE : View.GONE}"
android:onClick="@{() -> viewModel.takePhoto()}"
app:layout_constraintStart_toStartOf="@id/guidelineStart"
app:layout_constraintEnd_toEndOf="@id/guidelineEnd"
app:layout_constraintTop_toTopOf="@id/guidelineStatus"
android:contentDescription="@string/take_picture"
app:backgroundTint="?attr/colorPrimary"
app:tint="#FFF"
app:srcCompat="@drawable/ic_camera_caf"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="@{viewModel.statusVisibility ? View.VISIBLE : View.GONE}"
app:layout_constraintStart_toStartOf="@id/guidelineStart"
app:layout_constraintEnd_toEndOf="@id/guidelineEnd"
app:layout_constraintTop_toTopOf="@id/guidelineStatus">
<TextView
android:id="@+id/statusMessage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/bg_radius_caf"
android:gravity="center_horizontal"
android:lineSpacingExtra="7sp"
android:padding="10dp"
android:layout_marginTop="10dp"
android:textAlignment="center"
android:textColor="#606060"
android:textSize="15sp"
android:textStyle="bold"
android:text="@{viewModel.statusMessage}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/triangle_caf"
android:rotation="270"
android:adjustViewBounds="true"
android:contentDescription="@string/nothing_caf"
app:layout_constraintEnd_toEndOf="@id/statusMessage"
app:layout_constraintStart_toStartOf="@id/statusMessage"
app:layout_constraintTop_toTopOf="@id/statusMessage"
app:layout_constraintBottom_toTopOf="@id/statusMessage" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tvCurrentStepName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@id/tvPreviousStepName"
app:layout_constraintStart_toStartOf="@id/guidelineStart"
app:layout_constraintEnd_toEndOf="@id/guidelineEnd"
android:layout_marginBottom="5dp"
android:textSize="18sp"
android:textColor="#ffffff"
android:letterSpacing="0.06"
android:text="@{viewModel.currentStepName}"
android:gravity="center_horizontal" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:visibility="@{viewModel.currentStepDone ? View.VISIBLE : View.GONE}"
android:contentDescription="@string/check_caf"
app:layout_constraintTop_toTopOf="@id/tvCurrentStepName"
app:layout_constraintBottom_toBottomOf="@id/tvCurrentStepName"
app:layout_constraintEnd_toStartOf="@id/tvCurrentStepName"
android:layout_marginEnd="8dp"
android:src="@drawable/ic_check_caf" />
<TextView
android:id="@+id/tvPreviousStepName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="@id/guidelineStart"
app:layout_constraintEnd_toEndOf="@id/guidelineEnd"
app:layout_constraintBottom_toBottomOf="@id/guidelineBottom"
android:textSize="16sp"
android:textColor="#66FFFFFF"
android:letterSpacing="0.06"
android:text="@{viewModel.previousStepName}"
android:gravity="center_horizontal" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:visibility="@{viewModel.previousStepDone ? View.VISIBLE : View.GONE}"
android:contentDescription="@string/check_caf"
app:layout_constraintTop_toTopOf="@id/tvPreviousStepName"
app:layout_constraintBottom_toBottomOf="@id/tvPreviousStepName"
app:layout_constraintEnd_toStartOf="@id/tvPreviousStepName"
android:layout_marginEnd="8dp"
android:alpha="0.4"
android:src="@drawable/ic_check_caf" />
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="64dp"
android:layout_height="64dp"
android:indeterminate="true"
android:indeterminateTint="?attr/colorPrimary"
android:indeterminateTintMode="src_atop"
android:visibility="@{viewModel.loadingStatus ? View.VISIBLE : View.GONE}"
app:layout_constraintBottom_toBottomOf="@id/guidelineBottom"
app:layout_constraintEnd_toEndOf="@id/guidelineEnd"
app:layout_constraintStart_toStartOf="@id/guidelineStart"
app:layout_constraintTop_toTopOf="@id/guidelineTop"
app:layout_constraintVertical_bias="0.45" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment