<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (c) 2022 Proton AG
  ~
  ~ This file is part of Proton Mail.
  ~
  ~ Proton Mail is free software: you can redistribute it and/or modify
  ~ it under the terms of the GNU General Public License as published by
  ~ the Free Software Foundation, either version 3 of the License, or
  ~ (at your option) any later version.
  ~
  ~ Proton Mail is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  ~ GNU General Public License for more details.
  ~
  ~ You should have received a copy of the GNU General Public License
  ~ along with Proton Mail. If not, see https://www.gnu.org/licenses/.
  -->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginStart="@dimen/padding_xl"
    android:layout_marginEnd="@dimen/padding_xl"
    android:background="@color/background_norm">

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.5" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/vertical"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.5" />

    <ImageView
        android:id="@+id/lock_icon"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:srcCompat="@drawable/ic_proton_lock"
        app:layout_constraintBottom_toTopOf="@id/mPinEdit"
        app:layout_constraintTop_toTopOf="parent" />

    <ch.protonmail.android.views.SecureEditText
        android:id="@+id/mPinEdit"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/padding_xl"
        app:layout_constraintBottom_toTopOf="@id/btn_pin_2"
        app:layout_constraintTop_toBottomOf="@+id/lock_icon" />

    <ch.protonmail.android.views.RoundButton
        android:id="@+id/btn_pin_1"
        style="@style/CustomKeyboardButton"
        android:layout_marginBottom="@dimen/padding_l"
        android:filterTouchesWhenObscured="true"
        android:importantForAccessibility="yes"
        android:text="@string/button_key_1"
        app:keyValue="@string/button_key_1"
        app:layout_constraintBottom_toTopOf="@id/btn_pin_4"
        app:layout_constraintEnd_toStartOf="@id/btn_pin_2"
        app:layout_constraintHorizontal_chainStyle="packed"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintVertical_chainStyle="packed" />

    <ch.protonmail.android.views.RoundButton
        android:id="@+id/btn_pin_2"
        style="@style/CustomKeyboardButton"
        android:layout_marginBottom="@dimen/padding_l"
        android:filterTouchesWhenObscured="true"
        android:importantForAccessibility="yes"
        android:text="@string/button_key_2"
        app:keyValue="@string/button_key_2"
        app:layout_constraintBottom_toTopOf="@id/btn_pin_5"
        app:layout_constraintEnd_toStartOf="@id/btn_pin_3"
        app:layout_constraintHorizontal_chainStyle="packed"
        app:layout_constraintStart_toEndOf="@id/btn_pin_1"
        app:layout_constraintVertical_chainStyle="packed" />

    <ch.protonmail.android.views.RoundButton
        android:id="@+id/btn_pin_3"
        style="@style/CustomKeyboardButton"
        android:layout_marginBottom="@dimen/padding_l"
        android:filterTouchesWhenObscured="true"
        android:importantForAccessibility="yes"
        android:text="@string/button_key_3"
        app:keyValue="@string/button_key_3"
        app:layout_constraintBottom_toTopOf="@id/btn_pin_6"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_chainStyle="packed"
        app:layout_constraintStart_toEndOf="@id/btn_pin_2"
        app:layout_constraintVertical_chainStyle="packed" />

    <ch.protonmail.android.views.RoundButton
        android:id="@+id/btn_pin_4"
        style="@style/CustomKeyboardButton"
        android:filterTouchesWhenObscured="true"
        android:importantForAccessibility="yes"
        android:text="@string/button_key_4"
        app:keyValue="@string/button_key_4"
        app:layout_constraintBottom_toTopOf="@id/horizontal"
        app:layout_constraintEnd_toStartOf="@id/btn_pin_5"
        app:layout_constraintHorizontal_chainStyle="packed"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintVertical_chainStyle="packed" />

    <ch.protonmail.android.views.RoundButton
        android:id="@+id/btn_pin_5"
        style="@style/CustomKeyboardButton"
        android:filterTouchesWhenObscured="true"
        android:importantForAccessibility="yes"
        android:text="@string/button_key_5"
        app:keyValue="@string/button_key_5"
        app:layout_constraintBottom_toTopOf="@id/horizontal"
        app:layout_constraintEnd_toStartOf="@id/btn_pin_6"
        app:layout_constraintHorizontal_chainStyle="packed"
        app:layout_constraintStart_toEndOf="@id/btn_pin_4"
        app:layout_constraintVertical_chainStyle="packed" />

    <ch.protonmail.android.views.RoundButton
        android:id="@+id/btn_pin_6"
        style="@style/CustomKeyboardButton"
        android:filterTouchesWhenObscured="true"
        android:importantForAccessibility="yes"
        android:text="@string/button_key_6"
        app:keyValue="@string/button_key_6"
        app:layout_constraintBottom_toTopOf="@id/horizontal"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_chainStyle="packed"
        app:layout_constraintStart_toEndOf="@id/btn_pin_5"
        app:layout_constraintVertical_chainStyle="packed" />

    <ch.protonmail.android.views.RoundButton
        android:id="@+id/btn_pin_7"
        style="@style/CustomKeyboardButton"
        android:filterTouchesWhenObscured="true"
        android:importantForAccessibility="yes"
        android:text="@string/button_key_7"
        app:keyValue="@string/button_key_7"
        app:layout_constraintEnd_toStartOf="@id/btn_pin_8"
        app:layout_constraintHorizontal_chainStyle="packed"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/horizontal"
        app:layout_constraintVertical_chainStyle="packed" />

    <ch.protonmail.android.views.RoundButton
        android:id="@+id/btn_pin_8"
        style="@style/CustomKeyboardButton"
        android:filterTouchesWhenObscured="true"
        android:importantForAccessibility="yes"
        android:text="@string/button_key_8"
        app:keyValue="@string/button_key_8"
        app:layout_constraintEnd_toStartOf="@id/btn_pin_9"
        app:layout_constraintHorizontal_chainStyle="packed"
        app:layout_constraintStart_toEndOf="@id/btn_pin_7"
        app:layout_constraintTop_toBottomOf="@id/horizontal"
        app:layout_constraintVertical_chainStyle="packed" />

    <ch.protonmail.android.views.RoundButton
        android:id="@+id/btn_pin_9"
        style="@style/CustomKeyboardButton"
        android:filterTouchesWhenObscured="true"
        android:importantForAccessibility="yes"
        android:text="@string/button_key_9"
        app:keyValue="@string/button_key_9"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_chainStyle="packed"
        app:layout_constraintStart_toEndOf="@id/btn_pin_8"
        app:layout_constraintTop_toBottomOf="@id/horizontal"
        app:layout_constraintVertical_chainStyle="packed" />

    <LinearLayout
        android:id="@+id/fingerprint_wrapper"
        android:layout_width="@dimen/settings_pin_key_button_size"
        android:layout_height="0dp"
        android:layout_marginStart="@dimen/settings_pin_key_button_margin"
        android:layout_marginTop="@dimen/padding_l"
        android:layout_marginEnd="@dimen/settings_pin_key_button_margin"
        android:layout_marginBottom="@dimen/padding_m"
        android:gravity="center"
        android:orientation="vertical"
        app:layout_constraintBottom_toBottomOf="@id/btn_pin_0"
        app:layout_constraintEnd_toStartOf="@id/btn_pin_0"
        app:layout_constraintHorizontal_chainStyle="packed"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/btn_pin_7"
        app:layout_constraintTop_toTopOf="@id/btn_pin_0"
        app:layout_constraintVertical_chainStyle="packed">

        <ImageButton
            android:id="@+id/openFingerprintPrompt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/ic_proton_fingerprint"
            android:importantForAccessibility="yes"
            android:visibility="gone" />
    </LinearLayout>

    <ch.protonmail.android.views.RoundButton
        android:id="@+id/btn_pin_0"
        style="@style/CustomKeyboardButton"
        android:layout_marginTop="@dimen/padding_l"
        android:filterTouchesWhenObscured="true"
        android:importantForAccessibility="yes"
        android:text="@string/button_key_0"
        app:keyValue="@string/button_key_0"
        app:layout_constraintEnd_toStartOf="@id/backward_wrapper"
        app:layout_constraintStart_toEndOf="@id/fingerprint_wrapper"
        app:layout_constraintTop_toBottomOf="@id/btn_pin_8" />

    <LinearLayout
        android:id="@+id/backward_wrapper"
        android:layout_width="@dimen/settings_pin_key_button_size"
        android:layout_height="0dp"
        android:layout_marginStart="@dimen/settings_pin_key_button_margin"
        android:layout_marginTop="@dimen/padding_l"
        android:layout_marginEnd="@dimen/settings_pin_key_button_margin"
        android:layout_marginBottom="@dimen/padding_m"
        android:gravity="center"
        android:orientation="vertical"
        app:layout_constraintBottom_toBottomOf="@id/btn_pin_0"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_chainStyle="packed"
        app:layout_constraintStart_toEndOf="@id/btn_pin_0"
        app:layout_constraintTop_toBottomOf="@id/btn_pin_9"
        app:layout_constraintTop_toTopOf="@id/btn_pin_0"
        app:layout_constraintVertical_chainStyle="packed">

        <ImageButton
            android:id="@+id/backward_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/ic_proton_backspace"
            android:importantForAccessibility="yes"
            android:visibility="visible" />
    </LinearLayout>

    <Button
        android:id="@+id/mBtnForward"
        style="@style/ProtonButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/padding_m"
        android:layout_marginBottom="@dimen/padding_3xl"
        android:text="@string/confirm"
        android:visibility="visible"
        app:layout_constraintBottom_toBottomOf="parent" />

    <TextView
        android:id="@+id/mForgotPin"
        style="@style/Proton.Text.DefaultSmall.Interaction"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/padding_m"
        android:layout_marginBottom="@dimen/padding_3xl"
        android:gravity="center"
        android:text="@string/sign_out"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>