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

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">

        <com.google.android.material.appbar.AppBarLayout
            android:id="@+id/app_bar_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <com.google.android.material.appbar.MaterialToolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:minHeight="?attr/actionBarSize" />
        </com.google.android.material.appbar.AppBarLayout>


        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/next"
            android:layout_below="@id/app_bar_layout">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/instructions"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="16dp"
                    android:gravity="center_horizontal"
                    android:text="@string/enter_country_code_and_phone_number"
                    android:textAppearance="?textAppearanceBodyMedium" />

                <LinearLayout
                    android:id="@+id/phone_number_box"
                    android:layout_width="256dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:orientation="vertical">

                    <EditText
                        android:id="@+id/country"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:cursorVisible="false"
                        android:drawableEnd="@drawable/ic_arrow_drop_down_18dp"
                        android:focusable="false"
                        android:gravity="bottom|center_horizontal"
                        android:imeOptions="flagNoExtractUi"
                        android:inputType="textNoSuggestions"
                        android:longClickable="false"
                        app:drawableTint="?android:attr/textColorPrimary" />

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal">

                        <EditText
                            android:id="@+id/country_code"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:gravity="bottom|center_horizontal"
                            android:imeOptions="flagNoExtractUi"
                            android:inputType="number"
                            android:longClickable="false"
                            android:maxLength="3"
                            android:maxLines="1" />

                        <EditText
                            android:id="@+id/number"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="3"
                            android:gravity="bottom|start"
                            android:hint="@string/phone_number"
                            android:imeOptions="flagNoExtractUi"
                            android:inputType="number"
                            android:longClickable="false"
                            android:maxLines="1" />
                    </LinearLayout>

                    <ProgressBar
                        android:layout_margin="16dp"
                        android:id="@+id/progressBar"
                        style="?android:attr/progressBarStyle"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center" />
                </LinearLayout>
            </LinearLayout>
        </ScrollView>

        <Button
            android:id="@+id/next"
            style="@style/Widget.Material3.Button.ElevatedButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_alignParentBottom="true"
            android:layout_margin="16dp"
            android:text="@string/next" />
    </RelativeLayout>
</layout>
