<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2024 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.
  -->

<com.android.wm.shell.apptoweb.OpenByDefaultDialogView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    style="@style/LetterboxDialog">

    <!-- The background of the top-level layout acts as the background dim. -->
    <FrameLayout
        android:id="@+id/open_by_default_dialog_container"
        android:layout_width="@dimen/open_by_default_settings_dialog_width"
        android:layout_height="wrap_content"
        android:background="@drawable/open_by_default_settings_dialog_background"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent">

        <!-- The ScrollView should only wrap the content of the dialog, otherwise the background
             corner radius will be cut off when scrolling to the top/bottom. -->
        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <LinearLayout
                android:padding="24dp"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:orientation="vertical">

                <ImageView
                    android:id="@+id/application_icon"
                    android:layout_width="32dp"
                    android:layout_height="32dp"
                    android:layout_gravity="center_horizontal"
                    android:importantForAccessibility="no"
                    android:layout_marginTop="24dp"
                    android:layout_marginBottom="16dp"
                    android:scaleType="centerCrop"/>

                <TextView
                    android:id="@+id/application_name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:layout_marginBottom="8dp"
                    android:lineHeight="32dp"
                    android:textFontWeight="400"
                    android:textSize="24sp"
                    android:textColor="@androidprv:color/materialColorOnSurfaceVariant"
                    tools:text="Gmail" />

                <TextView
                    android:id="@+id/dialog_subheader"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textSize="12sp"
                    android:textFontWeight="400"
                    android:lineHeight="28dp"
                    android:layout_gravity="center_horizontal"
                    android:layout_marginBottom="16dp"
                    android:textColor="@androidprv:color/materialColorOnSurfaceVariant"
                    android:text="@string/open_by_default_dialog_subheader_text"/>

                <RadioGroup
                    android:id="@+id/open_by_default_radio_group"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal">
                    <RadioButton
                        android:id="@+id/open_in_app_button"
                        android:layout_width="@dimen/open_by_default_settings_dialog_radio_button_width"
                        android:layout_height="@dimen/open_by_default_settings_dialog_radio_button_height"
                        android:paddingStart="20dp"
                        android:paddingEnd="0dp"
                        android:layout_marginHorizontal="16dp"
                        android:layout_marginBottom="4dp"
                        android:text="@string/open_by_default_dialog_in_app_text"
                        android:textFontWeight="500"
                        android:textSize="16sp"
                        android:lineHeight="24dp"
                        android:background="@drawable/open_by_default_settings_dialog_radio_buttons_background"/>
                    <RadioButton
                        android:id="@+id/open_in_browser_button"
                        android:layout_width="@dimen/open_by_default_settings_dialog_radio_button_width"
                        android:layout_height="@dimen/open_by_default_settings_dialog_radio_button_height"
                        android:paddingStart="20dp"
                        android:paddingEnd="0dp"
                        android:layout_marginStart="16dp"
                        android:text="@string/open_by_default_dialog_in_browser_text"
                        android:textFontWeight="500"
                        android:textSize="16sp"
                        android:lineHeight="24dp"
                        android:background="@drawable/open_by_default_settings_dialog_radio_buttons_background"/>
                </RadioGroup>

                <Button
                    android:id="@+id/open_by_default_settings_dialog_confirm_button"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:minHeight="48dp"
                    android:text="@string/open_by_default_dialog_dismiss_button_text"
                    android:layout_gravity="end"
                    android:layout_marginHorizontal="24dp"
                    android:layout_marginTop="26dp"
                    android:layout_marginBottom="18dp"
                    android:textSize="14sp"
                    android:textFontWeight="500"
                    android:textColor="@androidprv:color/materialColorOnPrimary"
                    android:background="@drawable/open_by_default_settings_dialog_confirm_button_background"/>
            </LinearLayout>
        </ScrollView>
    </FrameLayout>
</com.android.wm.shell.apptoweb.OpenByDefaultDialogView>

