<?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:id="@+id/bottomSheet"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/bg_bottomsheet"
    android:divider="@drawable/divider"
    android:orientation="vertical"
    android:paddingStart="@dimen/padding_small"
    android:paddingEnd="@dimen/padding_small"
    android:showDividers="middle"
    app:behavior_hideable="false"
    app:behavior_peekHeight="@dimen/height_peek"
    app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">

    <ViewFlipper
        android:id="@+id/view_flipper"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:animateFirstView="true"
        android:inAnimation="@anim/fade_in"
        android:outAnimation="@anim/fade_out"
        tools:ignore="UselessParent">

        <com.aurora.store.view.custom.layouts.button.ActionButton
            android:id="@+id/btn_download"
            android:layout_width="match_parent"
            android:layout_height="@dimen/height_button"
            android:layout_marginTop="@dimen/margin_xsmall"
            android:layout_marginBottom="@dimen/margin_xsmall"
            android:text="@string/action_install"
            app:btnActionText="@string/action_install" />

        <RelativeLayout
            android:id="@+id/progress_layout"
            android:layout_width="match_parent"
            android:layout_height="@dimen/height_button"
            android:layout_marginTop="@dimen/margin_xsmall"
            android:layout_marginBottom="@dimen/margin_xsmall"
            android:gravity="center_vertical"
            android:weightSum="4">

            <ProgressBar
                android:id="@+id/progress_download"
                style="@style/Widget.AppCompat.ProgressBar.Horizontal"
                android:layout_width="match_parent"
                android:layout_height="@dimen/icon_size_small"
                android:layout_centerVertical="true"
                android:layout_toStartOf="@id/img_cancel"
                android:indeterminateTint="@color/colorScrim"
                android:progressDrawable="@drawable/progressbar_bg"
                tools:progress="40" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_toStartOf="@id/img_cancel"
                android:gravity="center_vertical"
                android:orientation="horizontal"
                android:weightSum="3">

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/txt_progress_percent"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_margin="@dimen/margin_xsmall"
                    android:layout_weight="1"
                    android:paddingStart="@dimen/padding_normal"
                    android:paddingEnd="@dimen/padding_normal"
                    android:text="0%"
                    android:textAlignment="center"
                    android:textAppearance="@style/TextAppearance.Aurora.Title"
                    android:textColor="@color/colorWhite"
                    android:textSize="32sp" />

                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="@dimen/margin_small"
                    android:layout_weight="2"
                    android:orientation="vertical">

                    <androidx.appcompat.widget.AppCompatTextView
                        android:id="@+id/txt_speed"
                        style="@style/TextAppearance.Aurora.Line1"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/download_speed_estimating"
                        android:textColor="@color/colorWhite" />

                    <androidx.appcompat.widget.AppCompatTextView
                        android:id="@+id/txt_eta"
                        style="@style/TextAppearance.Aurora.Line2"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/download_eta_calculating"
                        android:textColor="@color/colorWhite" />
                </LinearLayout>
            </LinearLayout>

            <androidx.appcompat.widget.AppCompatImageView
                android:id="@+id/img_cancel"
                android:layout_width="@dimen/icon_size_small"
                android:layout_height="@dimen/icon_size_small"
                android:layout_alignParentEnd="true"
                android:layout_centerVertical="true"
                android:layout_marginStart="@dimen/margin_small"
                android:background="@drawable/bg_cancel"
                android:padding="@dimen/padding_medium"
                app:srcCompat="@drawable/ic_cancel" />
        </RelativeLayout>
    </ViewFlipper>

    <LinearLayout
        android:id="@+id/bottomsheet_body"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clickable="false"
        android:divider="@drawable/divider"
        android:focusable="false"
        android:orientation="vertical"
        android:paddingBottom="@dimen/padding_normal"
        android:showDividers="middle">

        <androidx.appcompat.widget.AppCompatTextView
            style="@style/TextAppearance.Aurora.Title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:alpha=".75"
            android:text="@string/purchase_failed"
            android:textAlignment="center" />

        <androidx.appcompat.widget.AppCompatTextView
            android:id="@+id/txt_purchase_error"
            style="@style/TextAppearance.Aurora.Line1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textAlignment="center"
            android:textColor="@color/colorWhite"
            tools:text="@string/purchase_invalid" />
    </LinearLayout>
</LinearLayout>