<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <data>

        <variable
            name="detectedCount"
            type="androidx.lifecycle.LiveData&lt;Integer>" />

        <variable
            name="percentageValue"
            type="Float" />

        <variable
            name="cancelClick"
            type="android.view.View.OnClickListener" />

        <import type="com.atmob.common.text.TextUtil" />
    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:keepScreenOn="true"
        android:layout_height="match_parent"
        tools:background="@color/black70">


        <View
            android:id="@+id/v_bg"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:background="@drawable/bg_dialog_bg"
            app:layout_constraintDimensionRatio="280:182"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintWidth_percent="0.7777777777777778" />


        <TextView
            android:id="@+id/tv_dialog_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="24dp"
            android:text="@string/dialog_scanning_title"
            android:textColor="#404040"
            android:textSize="14sp"
            android:textStyle="bold"
            app:layout_constraintBottom_toBottomOf="@+id/v_bg"
            app:layout_constraintStart_toStartOf="@+id/v_bg"
            app:layout_constraintTop_toTopOf="@id/v_bg"
            app:layout_constraintVertical_bias="0.3024691358024691" />

        <TextView
            android:id="@+id/tv_count"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="2dp"
            android:text="@{String.valueOf(detectedCount)}"
            android:textColor="#699CFF"
            android:textSize="14sp"
            android:textStyle="bold"
            app:layout_constraintBaseline_toBaselineOf="@+id/tv_dialog_title"
            app:layout_constraintStart_toEndOf="@+id/tv_dialog_title"
            tools:text="1245" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="2dp"
            android:text="@string/dialog_item"
            android:textColor="#404040"
            android:textSize="14sp"
            android:textStyle="bold"
            app:layout_constraintBaseline_toBaselineOf="@+id/tv_count"
            app:layout_constraintStart_toEndOf="@+id/tv_count" />

        <Space
            android:id="@+id/space2"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintDimensionRatio="360:6"
            app:layout_constraintTop_toBottomOf="@+id/tv_dialog_title" />

        <ProgressBar
            android:id="@+id/scan_progress_bar"
            style="?android:attr/progressBarStyleHorizontal"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:max="100"
            android:progress="@{(int)percentageValue}"
            android:progressDrawable="@drawable/bg_progress_bar_horizontal_scan"
            app:layout_constraintDimensionRatio="232:16"
            app:layout_constraintEnd_toEndOf="@+id/v_bg"
            app:layout_constraintStart_toStartOf="@id/v_bg"
            app:layout_constraintTop_toBottomOf="@+id/space2"
            app:layout_constraintWidth_percent="0.6444444444444444"
            tools:progress="50" />


        <ImageView
            android:id="@+id/iv_scan_progress_bg"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginBottom="3.5dp"
            android:src="@drawable/bg_scan_progress_value"
            app:layout_constraintBottom_toTopOf="@+id/scan_progress_bar"
            app:layout_constraintDimensionRatio="114:68"
            app:layout_constraintEnd_toEndOf="@+id/scan_progress_bar"
            app:layout_constraintWidth_percent="0.1055555555555556" />

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="@{@string/percentage(TextUtil.formatFloatWithout0End(percentageValue,1))}"
            android:textColor="@color/white"
            android:textSize="12dp"
            app:layout_constraintBottom_toBottomOf="@+id/iv_scan_progress_bg"
            app:layout_constraintEnd_toEndOf="@+id/iv_scan_progress_bg"
            app:layout_constraintStart_toStartOf="@+id/iv_scan_progress_bg"
            app:layout_constraintTop_toTopOf="@+id/iv_scan_progress_bg"
            app:layout_constraintVertical_bias="0.1818181818181818"
            tools:text="99%" />

        <TextView
            android:id="@+id/tv_cancel"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:background="@drawable/bg_common_disable_btn"
            android:gravity="center"
            android:onClick="@{cancelClick}"
            android:text="@string/dialog_cancel_scan"
            android:textColor="@color/white"
            android:textSize="14sp"
            app:layout_constraintBottom_toBottomOf="@+id/v_bg"
            app:layout_constraintDimensionRatio="120:36"
            app:layout_constraintEnd_toEndOf="@+id/v_bg"
            app:layout_constraintStart_toStartOf="@+id/v_bg"
            app:layout_constraintTop_toTopOf="@+id/v_bg"
            app:layout_constraintVertical_bias="0.8493150684931507"
            app:layout_constraintWidth_percent="0.3333333333333333" />


    </androidx.constraintlayout.widget.ConstraintLayout>
</layout>