<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Nextcloud Maps Geofavorites for Android
  ~
  ~ This program 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 3 of the License, or
  ~ (at your option) any later version.
  ~
  ~ This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
  -->
<LinearLayout
    android:id="@+id/root"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minWidth="300dp"
    android:orientation="vertical">

    <TextView
        android:id="@+id/header"
        style="@style/Base.DialogWindowTitle.AppCompat"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/standard_margin"
        android:text="@string/sort_by"/>

    <ScrollView
        android:id="@+id/scrollableSortings"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">

        <TableLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TableRow
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/standard_half_margin">

                <ImageButton
                    android:id="@+id/sortByTitleAscending"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:background="@color/transparent"
                    android:paddingStart="@dimen/standard_padding"
                    android:paddingTop="@dimen/standard_half_padding"
                    android:paddingEnd="@dimen/standard_half_padding"
                    android:paddingBottom="@dimen/standard_half_padding"
                    android:contentDescription="@string/menu_item_sort_by_title_a_z"
                    android:src="@drawable/ic_alphabetical_asc" />

                <TextView
                    android:id="@+id/sortByTitleAscendingText"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:layout_weight="1"
                    android:ellipsize="middle"
                    android:paddingStart="@dimen/zero"
                    android:paddingTop="@dimen/standard_half_padding"
                    android:paddingEnd="@dimen/standard_half_padding"
                    android:paddingBottom="@dimen/standard_half_padding"
                    android:singleLine="true"
                    android:text="@string/menu_item_sort_by_title_a_z"
                    android:textSize="@dimen/two_line_primary_text_size"/>

            </TableRow>

            <TableRow
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/standard_half_margin">

                <ImageButton
                    android:id="@+id/sortByCreationDateDescending"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:background="@color/transparent"
                    android:paddingStart="@dimen/standard_padding"
                    android:paddingTop="@dimen/standard_half_padding"
                    android:paddingEnd="@dimen/standard_half_padding"
                    android:paddingBottom="@dimen/standard_half_padding"
                    android:contentDescription="@string/menu_item_sort_by_date_newest_first"
                    android:src="@drawable/ic_modification_asc"/>

                <TextView
                    android:id="@+id/sortByCreationDateDescendingText"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:layout_weight="1"
                    android:ellipsize="middle"
                    android:paddingStart="@dimen/zero"
                    android:paddingTop="@dimen/standard_half_padding"
                    android:paddingEnd="@dimen/standard_half_padding"
                    android:paddingBottom="@dimen/standard_half_padding"
                    android:singleLine="true"
                    android:text="@string/menu_item_sort_by_date_newest_first"
                    android:textSize="@dimen/two_line_primary_text_size" />

            </TableRow>

            <TableRow
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/standard_half_margin">

                <ImageButton
                    android:id="@+id/sortByCategoryAscending"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:background="@color/transparent"
                    android:paddingStart="@dimen/standard_padding"
                    android:paddingTop="@dimen/standard_half_padding"
                    android:paddingEnd="@dimen/standard_half_padding"
                    android:paddingBottom="@dimen/standard_half_padding"
                    android:contentDescription="@string/menu_item_sort_by_category_a_z"
                    android:src="@drawable/ic_category_asc"/>

                <TextView
                    android:id="@+id/sortByCategoryAscendingText"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:layout_weight="1"
                    android:ellipsize="middle"
                    android:paddingStart="@dimen/zero"
                    android:paddingTop="@dimen/standard_half_padding"
                    android:paddingEnd="@dimen/standard_half_padding"
                    android:paddingBottom="@dimen/standard_half_padding"
                    android:singleLine="true"
                    android:text="@string/menu_item_sort_by_category_a_z"
                    android:textSize="@dimen/two_line_primary_text_size" />

            </TableRow>

            <TableRow
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/standard_half_margin"
                android:visibility="gone">  <!-- TODO: complete sorting by distance -->

                <ImageButton
                    android:id="@+id/sortByDistanceAscending"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:background="@color/transparent"
                    android:paddingStart="@dimen/standard_padding"
                    android:paddingTop="@dimen/standard_half_padding"
                    android:paddingEnd="@dimen/standard_half_padding"
                    android:paddingBottom="@dimen/standard_half_padding"
                    android:contentDescription="@string/menu_item_sort_by_distance_nearest_first"
                    android:src="@drawable/ic_distance_asc"/>

                <TextView
                    android:id="@+id/sortByDistanceAscendingText"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:layout_weight="1"
                    android:ellipsize="middle"
                    android:paddingStart="@dimen/zero"
                    android:paddingTop="@dimen/standard_half_padding"
                    android:paddingEnd="@dimen/standard_half_padding"
                    android:paddingBottom="@dimen/standard_half_padding"
                    android:singleLine="true"
                    android:text="@string/menu_item_sort_by_distance_nearest_first"
                    android:textSize="@dimen/two_line_primary_text_size" />

            </TableRow>

        </TableLayout>

    </ScrollView>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="end">

        <Button
            android:id="@+id/cancel"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/common_cancel"
            android:layout_marginTop="@dimen/standard_half_margin"/>

    </LinearLayout>

</LinearLayout>
