<?xml version="1.0" encoding="utf-8"?>

<!--
  ~ Aurora Store
  ~  Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
  ~
  ~  Aurora Store 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 2 of the License, or
  ~  (at your option) any later version.
  ~
  ~  Aurora Store 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 Aurora Store.  If not, see <http://www.gnu.org/licenses/>.
  ~
  -->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".view.ui.account.AccountFragment">

    <include
        android:id="@+id/layout_toolbar_action"
        layout="@layout/view_toolbar_action" />

    <HorizontalScrollView
        android:id="@+id/chip_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clipToPadding="false"
        android:paddingStart="@dimen/margin_small"
        android:paddingTop="@dimen/margin_normal"
        android:paddingEnd="@dimen/margin_small"
        android:paddingBottom="@dimen/margin_small"
        android:scrollbars="none">

        <com.google.android.material.chip.ChipGroup
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <com.google.android.material.chip.Chip
                android:id="@+id/chip_tos"
                style="@style/Widget.MaterialComponents.Chip.Action"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/menu_terms" />

            <com.google.android.material.chip.Chip
                android:id="@+id/chip_disclaimer"
                style="@style/Widget.MaterialComponents.Chip.Action"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/menu_disclaimer" />

            <com.google.android.material.chip.Chip
                android:id="@+id/chip_license"
                style="@style/Widget.MaterialComponents.Chip.Action"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/menu_license" />

        </com.google.android.material.chip.ChipGroup>
    </HorizontalScrollView>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:baselineAligned="false"
        android:orientation="horizontal"
        android:weightSum="2">

        <RelativeLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1">

            <androidx.appcompat.widget.AppCompatImageView
                android:id="@+id/img_avatar"
                android:layout_width="@dimen/icon_size_avatar"
                android:layout_height="@dimen/icon_size_avatar"
                android:layout_centerHorizontal="true"
                app:srcCompat="@drawable/bg_placeholder" />

            <androidx.appcompat.widget.AppCompatTextView
                android:id="@+id/txt_name"
                style="@style/TextAppearance.Aurora.Title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/img_avatar"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="@dimen/margin_normal"
                android:layout_marginBottom="@dimen/margin_small"
                android:textAlignment="center"
                tools:text="Aurora" />

            <androidx.appcompat.widget.AppCompatTextView
                android:id="@+id/txt_email"
                style="@style/TextAppearance.Aurora.Line1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/txt_name"
                android:layout_centerHorizontal="true"
                android:textAlignment="center"
                tools:text="auroraoss@gmail.com" />
        </RelativeLayout>

        <RelativeLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center_horizontal|center_vertical"
            android:orientation="vertical"
            android:padding="@dimen/padding_large">

            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/txt_logout_action"
                style="@style/AuroraTextStyle.Line1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_above="@id/btn_logout"
                android:layout_centerHorizontal="true"
                android:layout_marginBottom="@dimen/margin_normal"
                android:text="@string/account_logout"
                android:textAlignment="center" />

            <com.aurora.store.view.custom.layouts.button.StateButton
                android:id="@+id/btn_logout"
                android:layout_width="@dimen/width_button"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                app:btnStateIcon="@drawable/ic_logout"
                app:btnStateText="@string/action_logout" />
        </RelativeLayout>
    </LinearLayout>
</LinearLayout>