<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context=".MainActivity">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone">

        <ImageView
            android:id="@+id/imageView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:alpha="0.3"
            app:srcCompat="@drawable/osvc_splash" />
    </FrameLayout>

    <RelativeLayout
        android:id="@+id/defaultLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginBottom="0dp"
        android:background="#00000000">

        <LinearLayout
            android:id="@+id/header_bar"
            android:layout_width="match_parent"
            android:layout_height="64dp"
            android:background="@color/colorBaresip"
            android:orientation="horizontal"
            android:visibility="visible">

            <TextView
                android:id="@+id/textViewHeaderName"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_marginLeft="15dp"
                android:layout_weight="1"
                android:gravity="center_vertical"
                android:text="OSVC-C220"
                android:textAlignment="viewStart"
                android:textColor="@color/colorWhite"
                android:textSize="24sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/textViewHeaderIp"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_marginRight="15dp"
                android:layout_weight="1"
                android:gravity="center_vertical"
                android:text="0.0.0.0"
                android:textAlignment="viewEnd"
                android:textColor="@color/colorWhite"
                android:textSize="24sp"
                android:textStyle="bold" />
        </LinearLayout>

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/colorBaresip"
            android:elevation="4dp"
            android:visibility="gone"
            app:theme="@style/ActionBar"></androidx.appcompat.widget.Toolbar>

        <ScrollView
            android:id="@+id/scrollView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@id/header_bar"
            android:fillViewport="true">

            <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
                android:id="@+id/swipeRefresh"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <RelativeLayout
                    android:id="@+id/mainActivityLayout"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:focusable="true"
                    android:focusableInTouchMode="true"
                    android:paddingLeft="@dimen/activity_horizontal_margin"
                    android:paddingTop="@dimen/activity_vertical_margin"
                    android:paddingRight="@dimen/activity_horizontal_margin"
                    android:paddingBottom="@dimen/activity_vertical_margin">

                    <Spinner
                        android:id="@+id/aorSpinner"
                        android:layout_width="match_parent"
                        android:layout_height="48dp"
                        android:background="@color/cardview_shadow_start_color"
                        android:clickable="false"
                        android:gravity="center_vertical"
                        android:popupBackground="@color/colorSpinnerDropdown"
                        android:spinnerMode="dropdown" />

                    <LinearLayout
                        android:id="@+id/callTitleRow"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/aorSpinner"
                        android:layout_marginTop="12dp"
                        android:orientation="horizontal">

                        <TextView
                            android:id="@+id/callTitle"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginBottom="5dp"
                            android:gravity="start"
                            android:paddingStart="3dp"
                            android:paddingEnd="0dp"
                            android:text="@string/outgoing_call_to_dots"
                            android:textSize="20sp"></TextView>

                        <Chronometer
                            android:id="@+id/callTimer"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content"
                            android:gravity="end"
                            android:paddingStart="0dp"
                            android:paddingEnd="3dp"
                            android:textSize="18sp"
                            android:visibility="invisible"></Chronometer>

                    </LinearLayout>

                    <LinearLayout
                        android:id="@+id/uriRow"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/callTitleRow"
                        android:orientation="horizontal">

                        <AutoCompleteTextView
                            android:id="@+id/callUri"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:background="@drawable/custom_border"
                            android:enabled="false"
                            android:hint="@string/callee"
                            android:inputType="textEmailAddress"
                            android:textColorHint="@color/colorSecondaryDark"
                            android:textColor="#FF000000"
                            android:textSize="34sp">
                            <!-- <requestFocus /> -->
                        </AutoCompleteTextView>

                        <ImageButton
                            android:id="@+id/securityButton"
                            android:layout_width="24dp"
                            android:layout_height="24dp"
                            android:layout_gravity="center_vertical"
                            android:layout_weight="0"
                            android:background="#00000000"
                            android:contentDescription="@string/app_name_plus"
                            android:visibility="invisible"></ImageButton>

                    </LinearLayout>

                    <LinearLayout
                        android:id="@+id/diverter"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/uriRow"
                        android:orientation="vertical"
                        android:visibility="gone">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:gravity="start"
                            android:paddingStart="3dp"
                            android:paddingEnd="0dp"
                            android:text="@string/diverted_by_dots"
                            android:textSize="20sp"></TextView>

                        <TextView
                            android:id="@+id/diverterUri"
                            android:layout_width="fill_parent"
                            android:layout_height="0dp"
                            android:layout_weight="1"
                            android:paddingStart="6dp"
                            android:paddingTop="10dp"
                            android:paddingEnd="24dp"
                            android:textColor="@color/colorStrong"
                            android:textSize="20sp"></TextView>

                        <View
                            android:layout_width="fill_parent"
                            android:layout_height="1.5dp"
                            android:layout_marginStart="3dp"
                            android:layout_marginEnd="28dp"
                            android:background="@color/colorGray" />

                    </LinearLayout>

                    <RelativeLayout
                        android:id="@+id/callRow"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/diverter"
                        android:orientation="horizontal"
                        android:paddingTop="10dp"
                        android:paddingBottom="10dp">

                        <ImageButton
                            android:id="@+id/callButton"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:background="@null"
                            android:contentDescription="@string/call"
                            android:padding="0dp"
                            android:src="@drawable/call"
                            android:visibility="invisible"></ImageButton>

                        <ImageButton
                            android:id="@+id/callVideoButton"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginStart="0dp"
                            android:background="@null"
                            android:contentDescription="@string/video_call"
                            android:padding="0dp"
                            android:src="@drawable/call_video"
                            android:visibility="invisible"></ImageButton>

                        <ImageButton
                            android:id="@+id/hangupButton"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:background="@null"
                            android:clickable="false"
                            android:contentDescription="@string/hangup"
                            android:padding="0dp"
                            android:src="@drawable/hangup"
                            android:visibility="invisible"></ImageButton>

                        <ImageButton
                            android:id="@+id/answerButton"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_alignParentEnd="true"
                            android:layout_marginEnd="10dp"
                            android:background="@null"
                            android:clickable="false"
                            android:contentDescription="@string/answer"
                            android:padding="0dp"
                            android:src="@drawable/call"
                            android:visibility="invisible"></ImageButton>

                        <ImageButton
                            android:id="@+id/answerVideoButton"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_alignParentEnd="true"
                            android:layout_marginEnd="80dp"
                            android:background="@null"
                            android:clickable="false"
                            android:contentDescription="@string/answer"
                            android:padding="0dp"
                            android:src="@drawable/call_video"
                            android:visibility="invisible"></ImageButton>

                        <ImageButton
                            android:id="@+id/rejectButton"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:background="@null"
                            android:clickable="false"
                            android:contentDescription="@string/reject"
                            android:padding="0dp"
                            android:src="@drawable/hangup"
                            android:visibility="invisible"></ImageButton>

                        <RelativeLayout
                            android:id="@+id/callControl"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginStart="70dp"
                            android:orientation="horizontal"
                            android:visibility="invisible">

                            <ImageButton
                                android:id="@+id/videoButton"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:background="@null"
                                android:clickable="false"
                                android:contentDescription="@string/video_call"
                                android:src="@drawable/video_on"></ImageButton>

                            <ImageButton
                                android:id="@+id/holdButton"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginStart="60dp"
                                android:background="@null"
                                android:clickable="false"
                                android:contentDescription="@string/hold"
                                android:padding="0dp"
                                android:src="@drawable/call_hold"></ImageButton>

                            <ImageButton
                                android:id="@+id/transferButton"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginStart="120dp"
                                android:background="@null"
                                android:clickable="false"
                                android:contentDescription="@string/call_transfer"
                                android:padding="0dp"
                                android:src="@drawable/call_transfer"></ImageButton>

                            <EditText
                                android:id="@+id/dtmf"
                                android:layout_width="fill_parent"
                                android:layout_height="wrap_content"
                                android:layout_marginStart="180dp"
                                android:layout_marginEnd="48dp"
                                android:hint="@string/dtmf"
                                android:importantForAutofill="no"
                                android:inputType="phone"
                                android:textColorHint="@color/colorSecondaryDark"
                                android:textSize="20sp"></EditText>

                            <ImageButton
                                android:id="@+id/info"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignParentEnd="true"
                                android:layout_marginTop="6dp"
                                android:layout_marginEnd="0dp"
                                android:background="@null"
                                android:clickable="false"
                                android:contentDescription="@string/call_info"
                                android:padding="0dp"
                                android:src="@drawable/info"></ImageButton>

                        </RelativeLayout>

                    </RelativeLayout>

                </RelativeLayout>

            </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

        </ScrollView>

        <TextView
            android:id="@+id/onHoldNotice"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_above="@id/buttons"
            android:gravity="center"
            android:text="@string/call_is_on_hold"
            android:textColor="@color/colorAccent"
            android:textSize="18sp"
            android:visibility="gone"></TextView>

        <LinearLayout
            android:id="@+id/bottom_bar"
            android:layout_width="fill_parent"
            android:layout_height="52dp"
            android:layout_alignParentBottom="true"
            android:background="#150049"
            android:gravity="center"
            android:orientation="horizontal"
            android:paddingBottom="6dp">

            <TextView
                android:id="@+id/textViewDeviceName"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_marginLeft="15dp"
                android:layout_marginTop="8dp"
                android:layout_weight="1"
                android:textAlignment="viewStart"
                android:textColor="@color/colorWhite"
                android:textSize="24sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/textViewDatetime"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_marginTop="8dp"
                android:layout_marginRight="15dp"
                android:layout_weight="1"
                android:text=""
                android:textAlignment="viewEnd"
                android:textColor="#FFFFFF"
                android:textSize="24sp"
                android:visibility="visible" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/buttons"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:gravity="center"
            android:orientation="horizontal"
            android:paddingBottom="6dp">

            <Space
                android:layout_width="0dp"
                android:layout_height="1dp"
                android:layout_weight="1"></Space>

            <ImageButton
                android:id="@+id/voicemailButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@null"
                android:contentDescription="@string/voicemail"
                android:gravity="center_horizontal|center_vertical"
                android:src="@drawable/voicemail"
                android:visibility="gone"></ImageButton>

            <Space
                android:id="@+id/voicemailButtonSpace"
                android:layout_width="0dp"
                android:layout_height="1dp"
                android:layout_weight="1"
                android:visibility="gone"></Space>

            <ImageButton
                android:id="@+id/contactsButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@null"
                android:contentDescription="@string/contacts"
                android:gravity="center_horizontal|center_vertical"
                android:src="@drawable/contacts"
                android:visibility="invisible"
                tools:visibility="visible"></ImageButton>

            <Space
                android:layout_width="0dp"
                android:layout_height="1dp"
                android:layout_weight="1"></Space>

            <ImageButton
                android:id="@+id/messagesButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@null"
                android:contentDescription="@string/messages"
                android:gravity="center_horizontal|center_vertical"
                android:src="@drawable/messages"
                android:visibility="invisible"
                tools:visibility="visible"></ImageButton>

            <Space
                android:layout_width="0dp"
                android:layout_height="1dp"
                android:layout_weight="1"></Space>

            <ImageButton
                android:id="@+id/callsButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@null"
                android:contentDescription="@string/call_history"
                android:gravity="center_horizontal|center_vertical"
                android:src="@drawable/calls"
                android:visibility="invisible"
                tools:visibility="visible"></ImageButton>

            <Space
                android:layout_width="0dp"
                android:layout_height="1dp"
                android:layout_weight="1"></Space>

            <ImageButton
                android:id="@+id/dialpadButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@null"
                android:contentDescription="@string/dialpad"
                android:gravity="center_horizontal|center_vertical"
                android:src="@drawable/dialpad_off"
                android:visibility="invisible"
                tools:visibility="visible"></ImageButton>

            <Space
                android:layout_width="0dp"
                android:layout_height="1dp"
                android:layout_weight="1"></Space>

        </LinearLayout>

    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/videoLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginBottom="0dp"
        android:visibility="invisible" >
    </RelativeLayout>

    <FrameLayout
        android:id="@+id/dialogLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="invisible"
        tools:visibility="visible">

        <FrameLayout
            android:id="@+id/dialogBase"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginHorizontal="150px"
            android:layout_marginVertical="150px"
            android:background="@drawable/custom_border">

            <!--
            <androidx.appcompat.widget.AppCompatButton
                android:id="@+id/dialogButton1"
                android:layout_width="200dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="250px"
                android:layout_marginTop="250px"
                android:background="@drawable/bg_button_selector"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:gravity="center"
                android:padding="16dp"
                android:text="전화걸기"
                android:textColor="@color/colorWhite"
                android:textSize="30sp"
                android:textStyle="bold" />

            <androidx.appcompat.widget.AppCompatButton
                android:id="@+id/dialogButton2"
                android:layout_width="200dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="700px"
                android:layout_marginTop="250px"
                android:background="@drawable/bg_button_selector"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:gravity="center"
                android:padding="16dp"
                android:text="설정"
                android:textColor="@color/colorWhite"
                android:textSize="30sp"
                android:textStyle="bold" />
                -->

            <androidx.appcompat.widget.AppCompatButton
                android:id="@+id/dialogButtonImg1"
                android:layout_width="220px"
                android:layout_height="wrap_content"
                android:layout_marginLeft="400px"
                android:layout_marginTop="250px"
                android:background="@drawable/bg_button_selector"
                android:drawableTop="@drawable/callbutton2"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:gravity="center"
                android:padding="16dp"
                android:drawablePadding="25px"
                android:text="전화걸기"
                android:textColor="@color/colorWhite"
                android:textSize="30sp"
                android:textStyle="bold" />

            <androidx.appcompat.widget.AppCompatButton
                android:id="@+id/dialogButtonImg2"
                android:layout_width="220px"
                android:layout_height="wrap_content"
                android:layout_marginLeft="950px"
                android:layout_marginTop="250px"
                android:background="@drawable/bg_button_selector"
                android:drawableTop="@drawable/setting"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:gravity="center"
                android:padding="16dp"
                android:drawablePadding="25px"
                android:text="설정"
                android:textColor="@color/colorWhite"
                android:textSize="30sp"
                android:textStyle="bold" />

        </FrameLayout>
    </FrameLayout>

</RelativeLayout>
