<?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">

    <ScrollView
        android:id="@+id/layout_send_fragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        android:isScrollContainer="true"
        tools:context=".ui.fragment.SendFragment">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/content_fragment_send"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/fragment_send_background">

            <!--            -->
            <!-- Guidelines -->
            <!--            -->

            <androidx.constraintlayout.widget.Guideline
                android:id="@+id/guideline_content_start"
                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/guideline_content_end"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                app:layout_constraintGuide_percent="0.9" />

            <Space
                android:id="@+id/guideline_spacer"
                android:layout_width="0dp"
                android:layout_height="0dp"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintDimensionRatio="H,1:1"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="@id/guideline_content_end" />

            <View
                android:id="@+id/background_header"
                android:layout_width="match_parent"
                android:layout_height="48dp"
                android:background="@color/zcashWhite"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/main_toolbar"
                app:layout_constraintVertical_chainStyle="spread" />

            <TextView
                android:id="@+id/text_zec_value_available"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:layout_constraintBottom_toBottomOf="@id/background_header"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="@id/background_header"
                tools:text="12.82129334 ZEC Available" />

            <View
                android:id="@+id/transition_active_transaction_bg"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_marginTop="24dp"
                android:background="@drawable/background_rounded_corners"
                android:backgroundTint="@color/zcashWhite_40"
                app:layout_constraintBottom_toTopOf="@id/input_zcash_address"
                app:layout_constraintEnd_toEndOf="@id/guideline_content_end"
                app:layout_constraintHeight_default="percent"
                app:layout_constraintHeight_percent="0.2"
                app:layout_constraintStart_toStartOf="@id/guideline_content_start"
                app:layout_constraintTop_toBottomOf="@id/background_header"
                app:layout_constraintVertical_chainStyle="spread_inside" />

            <Button
                android:id="@+id/button_cancel_scan"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="4dp"
                android:background="@null"
                android:backgroundTint="@null"
                android:minWidth="0dp"
                android:minHeight="0dp"
                android:text="@string/cancel"
                android:textColor="@color/zcashRed"
                android:visibility="gone"
                app:layout_constraintEnd_toEndOf="@id/transition_active_transaction_bg"
                app:layout_constraintTop_toBottomOf="@id/transition_active_transaction_bg" />

            <TextView
                android:id="@+id/text_amount_background"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingStart="16dp"
                android:paddingLeft="16dp"
                android:paddingTop="16dp"
                android:text="@string/send_label_amount"
                android:textColor="@color/text_dark"
                app:layout_constraintStart_toStartOf="@id/transition_active_transaction_bg"
                app:layout_constraintTop_toTopOf="@id/transition_active_transaction_bg" />

            <!-- Currency swap symbol -->
            <ImageView
                android:id="@+id/image_swap_currency"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="18dp"
                android:backgroundTint="@color/zcashPrimaryMedium"
                android:foregroundTint="@color/colorAccent"
                app:layout_constraintBottom_toBottomOf="@id/transition_active_transaction_bg"
                app:layout_constraintEnd_toEndOf="@id/transition_active_transaction_bg"
                app:layout_constraintTop_toTopOf="@id/transition_active_transaction_bg"
                app:srcCompat="@drawable/ic_import_export_black" />

            <EditText
                android:id="@+id/text_value_header"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@null"
                android:inputType="numberDecimal"
                android:minWidth="12dp"
                android:maxLength="8"
                android:text="0"
                android:textColor="@color/text_dark"
                android:textSize="@dimen/text_size_h3"
                android:textStyle="bold"
                app:layout_constraintBottom_toBottomOf="@id/transition_active_transaction_bg"
                app:layout_constraintEnd_toEndOf="@id/transition_active_transaction_bg"
                app:layout_constraintStart_toStartOf="@id/transition_active_transaction_bg"
                app:layout_constraintTop_toTopOf="@id/transition_active_transaction_bg" />

            <TextView
                android:id="@+id/text_value_subheader"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@color/text_dark"
                app:layout_constraintEnd_toEndOf="@id/text_value_header"
                app:layout_constraintStart_toStartOf="@id/text_value_header"
                app:layout_constraintTop_toBottomOf="@id/text_value_header"
                tools:text="0 ZEC" />

            <!-- Zec symbol : header -->
            <ImageView
                android:id="@+id/image_zec_symbol_header"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:tint="@color/text_dark"
                app:layout_constraintEnd_toStartOf="@id/text_value_header"
                app:layout_constraintTop_toTopOf="@id/text_value_header"
                app:srcCompat="@drawable/ic_zec_symbol" />

            <!-- Zec symbol : subheader -->
            <ImageView
                android:id="@+id/image_zec_symbol_subheader"
                android:layout_width="8dp"
                android:layout_height="0dp"
                android:layout_marginTop="4dp"
                android:tint="@color/text_dark"
                tools:visibility="invisible"
                app:layout_constraintDimensionRatio="H,1:1"
                app:layout_constraintEnd_toStartOf="@id/text_value_subheader"
                app:layout_constraintTop_toTopOf="@id/text_value_subheader"
                app:srcCompat="@drawable/ic_zec_symbol" />

            <TextView
                android:id="@+id/text_dollar_symbol_header"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="$"
                android:textColor="@color/text_dark"
                android:textSize="18dp"
                android:includeFontPadding="false"
                android:textStyle="bold"
                tools:visibility="invisible"
                app:layout_constraintEnd_toStartOf="@id/text_value_header"
                app:layout_constraintBottom_toBottomOf="@id/image_zec_symbol_header"
                />

            <TextView
                android:id="@+id/text_dollar_symbol_subheader"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:includeFontPadding="false"
                android:layout_marginRight="2dp"
                android:text="$"
                android:textColor="@color/text_dark"
                android:textSize="8dp"
                app:layout_constraintEnd_toStartOf="@id/text_value_subheader"
                app:layout_constraintTop_toTopOf="@id/image_zec_symbol_subheader" />

            <!-- Address -->
            <EditText
                android:id="@+id/input_zcash_address"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:hint="@string/send_hint_input_zcash_address"
                android:paddingRight="76dp"
                android:singleLine="true"
                app:backgroundTint="@color/zcashBlack_12"
                app:layout_constraintBottom_toTopOf="@id/text_area_memo"
                app:layout_constraintEnd_toEndOf="@id/guideline_content_end"
                app:layout_constraintHorizontal_bias="0.0"
                app:layout_constraintStart_toStartOf="@id/guideline_content_start"
                app:layout_constraintTop_toBottomOf="@id/transition_active_transaction_bg" />

            <TextView
                android:id="@+id/text_address_error"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:layout_marginLeft="8dp"
                android:fontFamily="@font/inconsolata"
                android:textColor="@color/zcashRed"
                android:textSize="@dimen/text_size_caption"
                app:layout_constraintStart_toStartOf="@id/input_zcash_address"
                app:layout_constraintTop_toBottomOf="@id/input_zcash_address" />

            <!-- Scan QR code -->
            <ImageView
                android:id="@+id/image_scan_qr"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="8dp"
                android:tint="@color/zcashBlack_87"
                app:layout_constraintBottom_toBottomOf="@id/input_zcash_address"
                app:layout_constraintEnd_toEndOf="@id/input_zcash_address"
                app:layout_constraintTop_toTopOf="@id/input_zcash_address"
                app:srcCompat="@drawable/ic_qrcode_24dp" />

            <ImageView
                android:id="@+id/image_address_shortcut"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="16dp"
                app:layout_constraintBottom_toBottomOf="@id/image_scan_qr"
                app:layout_constraintEnd_toStartOf="@id/image_scan_qr"
                app:layout_constraintTop_toTopOf="@id/image_scan_qr"
                app:srcCompat="@drawable/ic_content_paste_black_24dp" />

            <TextView
                android:id="@+id/text_to_label"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/send_label_to"
                app:layout_constraintBottom_toTopOf="@id/input_zcash_address"
                app:layout_constraintStart_toStartOf="@id/input_zcash_address" />

            <!-- memo -->
            <EditText
                android:id="@+id/text_area_memo"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:background="@drawable/background_rounded_corners"
                android:gravity="top|left"
                android:inputType="textMultiLine"
                android:maxLength="@integer/memo_max_length"
                android:padding="16dp"
                app:backgroundTint="@color/zcashWhite_60"
                app:layout_constraintBottom_toTopOf="@id/button_send_zec"
                app:layout_constraintEnd_toEndOf="@id/guideline_content_end"
                app:layout_constraintHeight_default="percent"
                app:layout_constraintHeight_percent="0.25"
                app:layout_constraintStart_toStartOf="@id/guideline_content_start"
                app:layout_constraintTop_toBottomOf="@id/input_zcash_address" />

            <Button
                android:id="@+id/button_send_zec"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/send_submit_button_text"
                app:layout_constraintBottom_toTopOf="@id/guideline_spacer"
                app:layout_constraintEnd_toEndOf="@id/text_area_memo"
                app:layout_constraintTop_toBottomOf="@id/text_area_memo" />

            <ProgressBar
                android:id="@+id/progress_send"
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:indeterminate="true"
                android:padding="8dp"
                android:theme="@style/Zcash.Progressbar.Indeterminate"
                android:visibility="gone"
                app:layout_constraintBottom_toBottomOf="@+id/button_send_zec"
                app:layout_constraintEnd_toStartOf="@+id/button_send_zec"
                app:layout_constraintTop_toTopOf="@+id/button_send_zec" />

            <View
                android:id="@+id/divider_memo"
                android:layout_width="0dp"
                android:layout_height="1dp"
                android:layout_marginBottom="40dp"
                android:background="@color/zcashBlack_12"
                app:layout_constraintBottom_toBottomOf="@id/text_area_memo"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintWidth_default="percent"
                app:layout_constraintWidth_percent="0.7" />

            <TextView
                android:id="@+id/text_memo_char_count"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="0 / 512"
                android:textColor="@color/zcashGray"
                app:layout_constraintBottom_toBottomOf="@id/text_area_memo"
                app:layout_constraintEnd_toEndOf="@id/divider_memo"
                app:layout_constraintTop_toBottomOf="@id/divider_memo" />

            <!-- Scan Area -->
            <FrameLayout
                android:id="@+id/camera_placeholder"
                android:layout_width="0dp"
                android:layout_height="0dp"
                tools:visibility="gone"
                app:layout_constraintBottom_toBottomOf="@id/transition_active_transaction_bg"
                app:layout_constraintEnd_toEndOf="@id/transition_active_transaction_bg"
                app:layout_constraintStart_toStartOf="@id/transition_active_transaction_bg"
                app:layout_constraintTop_toTopOf="@id/transition_active_transaction_bg" />

            <!--        -->
            <!-- Dialog -->
            <!--        -->

            <View
                android:id="@+id/dialog_send_background"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@color/zcashBlack_54"
                android:transitionName="@string/transition_active_transaction_background"
                android:visibility="gone"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                tools:visibility="gone" />

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/dialog_send_contents"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:background="@drawable/background_rounded_corners_opaque"
                android:backgroundTint="@color/zcashWhite"
                android:clickable="true"
                android:focusable="true"
                android:transitionName="@string/transition_active_transaction_card"
                android:visibility="gone"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintWidth_default="percent"
                app:layout_constraintWidth_percent="0.80"
                tools:visibility="gone">

                <TextView
                    android:id="@+id/dialog_text_title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:padding="16dp"
                    android:text="Send 1.73 ZEC ($200.23)?"
                    android:textSize="@dimen/text_size_h6"
                    android:textStyle="bold"
                    android:transitionName="@string/transition_active_transaction_title"
                    app:layout_constraintBottom_toTopOf="@id/dialog_text_address"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintVertical_chainStyle="spread_inside" />

                <TextView
                    android:id="@+id/dialog_text_to"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:padding="16dp"
                    android:text="To"
                    android:textColor="@color/text_dark_dimmed"
                    android:textSize="@dimen/text_size_body_1"
                    app:layout_constraintBottom_toBottomOf="@+id/dialog_text_address"
                    app:layout_constraintEnd_toStartOf="@+id/dialog_text_address"
                    app:layout_constraintHorizontal_chainStyle="spread_inside"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="@+id/dialog_text_address" />

                <TextView
                    android:id="@+id/dialog_text_address"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:fontFamily="@font/inconsolata"
                    android:lines="3"
                    android:paddingTop="16dp"
                    android:paddingEnd="16dp"
                    android:paddingRight="16dp"
                    android:text="ztestsapling1snmqdnfqnc407pvqw7sld8w5zxx6nd0523kvlj4jf39uvxvh7vn0hs3q38n07806dwwecqwke3t"
                    android:textColor="@color/colorPrimary"
                    android:textSize="@dimen/text_size_body_1"
                    android:transitionName="@string/transition_active_transaction_address"
                    app:layout_constraintBottom_toTopOf="@+id/dialog_text_memo_included"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toEndOf="@id/dialog_text_to"
                    app:layout_constraintTop_toBottomOf="@id/dialog_text_title" />

                <TextView
                    android:id="@+id/dialog_text_memo_included"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:drawableLeft="@drawable/ic_check_black_24dp"
                    android:drawablePadding="8dp"
                    android:drawableTint="@color/colorPrimary"
                    android:paddingTop="30dp"
                    android:paddingBottom="30dp"
                    android:text="Includes a transaction memo"
                    android:textColor="@color/text_dark_dimmed"
                    android:textSize="@dimen/text_size_body_1"
                    app:layout_constraintBottom_toTopOf="@id/dialog_divider"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/dialog_text_address" />

                <View
                    android:id="@+id/dialog_divider"
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:background="@color/divider_background"
                    app:layout_constraintBottom_toTopOf="@+id/dialog_submit_button"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/dialog_text_memo_included"
                    app:layout_goneMarginTop="32dp" />

                <Button
                    android:id="@+id/dialog_submit_button"
                    android:layout_width="match_parent"
                    android:layout_height="48dp"
                    android:background="@null"
                    android:text="send"
                    android:textColor="@color/colorPrimary"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/dialog_divider" />
            </androidx.constraintlayout.widget.ConstraintLayout>

            <!--        -->
            <!-- Groups -->
            <!--        -->

            <androidx.constraintlayout.widget.Group
                android:id="@+id/group_dialog_send"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:visibility="gone"
                app:constraint_referenced_ids="dialog_send_contents, dialog_send_background" />

            <androidx.constraintlayout.widget.Group
                android:id="@+id/group_hidden_during_scan"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:constraint_referenced_ids="
                transition_active_transaction_bg,
                text_value_subheader,
                text_dollar_symbol_subheader,
                image_zec_symbol_subheader,
                image_zec_symbol_header,
                text_dollar_symbol_header,
                text_amount_background,
                text_value_header,
                image_swap_currency" />

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