<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 2023, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License")
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->

<!-- This file is needed when flag lockscreen.enable_landscape is on
     Required for landscape lockscreen on small screens. -->
<com.android.keyguard.KeyguardPasswordView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/res-auto"
    android:id="@+id/keyguard_password_view"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center_horizontal|bottom"
    android:gravity="bottom">

    <!-- Layout here is visually identical to the previous keyguard_password_view.
         I.E., 'constraints here effectively the same as the previous linear layout' -->
    <androidx.constraintlayout.motion.widget.MotionLayout
        android:id="@+id/password_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:maxWidth="@dimen/keyguard_security_width"
        android:layout_gravity="center_horizontal"
        android:clipChildren="false"
        android:clipToPadding="false"
        android:layoutDirection="ltr"
        android:orientation="vertical"
        androidprv:layoutDescription="@xml/keyguard_password_scene">

        <!-- Guideline need to align password right of centre,
        when on small screen landscape layout -->
        <androidx.constraintlayout.widget.Guideline
            android:id="@+id/password_center_guideline"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            androidprv:layout_constraintGuide_percent="0.5" />

        <LinearLayout
            android:id="@+id/keyguard_bouncer_message_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clipChildren="false"
            android:clipToPadding="false"
            android:layoutDirection="ltr"
            android:orientation="vertical"
            androidprv:layout_constraintTop_toTopOf="parent">

            <include layout="@layout/keyguard_bouncer_message_area" />

            <com.android.systemui.bouncer.ui.BouncerMessageView
                android:id="@+id/bouncer_message_view"
                android:importantForAccessibility="noHideDescendants"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" />

        </LinearLayout>

        <FrameLayout
            android:id="@+id/passwordEntry_container"
            android:layout_width="280dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:theme="?attr/passwordStyle"
            androidprv:layout_constraintBottom_toTopOf="@+id/keyguard_selector_fade_container"
            androidprv:layout_constraintEnd_toEndOf="parent"
            androidprv:layout_constraintHorizontal_bias="0.5"
            androidprv:layout_constraintStart_toStartOf="parent"
            androidprv:layout_constraintTop_toBottomOf="@+id/keyguard_bouncer_message_container"
            androidprv:layout_constraintVertical_bias="0.7777">

            <EditText
                android:id="@+id/passwordEntry"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:contentDescription="@string/keyguard_accessibility_password"
                android:gravity="center_horizontal"
                android:layout_gravity="center"
                android:imeOptions="flagForceAscii|actionDone"
                android:inputType="textPassword"
                android:maxLength="500"
                android:singleLine="true"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textCursorDrawable="@null"
                android:textSize="16sp"
                android:textStyle="normal" />

            <ImageView
                android:id="@+id/switch_ime_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="end|center_vertical"
                android:layout_marginBottom="12dp"
                android:background="?android:attr/selectableItemBackground"
                android:clickable="true"
                android:contentDescription="@string/accessibility_ime_switch_button"
                android:padding="8dip"
                android:src="@drawable/ic_lockscreen_ime"
                android:tint="?android:attr/textColorPrimary"
                android:visibility="gone" />
        </FrameLayout>

        <include
            android:id="@+id/keyguard_selector_fade_container"
            layout="@layout/keyguard_eca"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="12dp"
            android:orientation="vertical"
            androidprv:layout_constraintBottom_toBottomOf="parent" />

    </androidx.constraintlayout.motion.widget.MotionLayout>

</com.android.keyguard.KeyguardPasswordView>
