<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@drawable/gradient_background"
        app:layout_collapseMode="pin"
        app:elevation="0dp">

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_collapseMode="pin"
            android:layout_margin="10dp">

            <ImageButton
                android:id="@+id/drawer_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/action_settings"
                android:background="@drawable/ic_drawer_white_24dp"
                android:visibility="visible"
                android:layout_gravity="start|center_vertical"
                android:contentDescription="@string/drawer"/>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:gravity="center"
                android:text="@string/title_market_cap"
                android:textSize="18sp"
                android:textColor="@color/white"
                android:textStyle="bold"/>

        </FrameLayout>

    </android.support.v7.widget.Toolbar>

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swiperefreshmarketcap"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="?attr/actionBarSize"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        android:background="@drawable/gradient_background">

        <LinearLayout android:id="@+id/layoutMarketCap"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:paddingTop="20dp"
            android:background="@drawable/list_background">

            <ProgressBar
                android:id="@+id/progressBarMarketCap"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                style="?android:attr/progressBarStyleLarge"
                android:layout_gravity="center"
                android:background="@drawable/circular_progress_bar" />

            <LinearLayout
                android:id="@+id/layoutProgressMarketCap"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:visibility="gone"
                android:orientation="vertical">

                <FrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="350dp"
                    android:layout_marginTop="5dp">

                    <com.herbron.moodl.CustomLayouts.CustomPieChart
                        android:id="@+id/marketCapPieChart"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"/>

                    <ImageView
                        android:id="@+id/currencyIcon"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:clickable="false"
                        android:focusable="false"
                        android:layout_gravity="center"
                        android:visibility="gone"
                        android:maxHeight="110dp"
                        android:maxWidth="110dp"
                        android:adjustViewBounds="true"/>

                </FrameLayout>

                <LinearLayout
                    android:id="@+id/layoutMarketDetails"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:layout_margin="10dp">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:id="@+id/textViewTitle"
                        android:textStyle="bold"
                        android:textSize="20sp"/>

                    <View
                        android:layout_width="match_parent"
                        android:layout_height="@dimen/separationLineSize"
                        android:layout_gravity="center_vertical"
                        android:layout_margin="10dp"
                        android:background="@color/separationColor" />

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

                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="0.5"
                            android:orientation="vertical">

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/market_capitalization"
                                android:textStyle="bold"/>

                            <TextView
                                android:id="@+id/textViewMarketCap"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"/>

                            <LinearLayout
                                android:id="@+id/layoutPercentageDominance"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:orientation="vertical"
                                android:visibility="gone"
                                android:layout_marginTop="5dp">

                                <TextView
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:text="@string/dominance_percentage"
                                    android:textStyle="bold"/>

                                <TextView
                                    android:id="@+id/textViewDominancePercentage"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"/>

                            </LinearLayout>

                            <LinearLayout
                                android:id="@+id/layoutActiveCrypto"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:orientation="vertical"
                                android:layout_marginTop="5dp">

                                <TextView
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:text="@string/active_cryptocurrencies"
                                    android:textStyle="bold"/>

                                <TextView
                                    android:id="@+id/textViewActiveCrypto"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"/>

                            </LinearLayout>

                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="0.5"
                            android:orientation="vertical">

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/volume_24h"
                                android:textStyle="bold"/>

                            <TextView
                                android:id="@+id/textViewVolume"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"/>

                            <LinearLayout
                                android:id="@+id/layoutActiveMarkets"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:orientation="vertical"
                                android:layout_marginTop="5dp">

                                <TextView
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:text="@string/active_marketes"
                                    android:textStyle="bold"/>

                                <TextView
                                    android:id="@+id/textViewActiveMarkets"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"/>

                            </LinearLayout>

                        </LinearLayout>

                    </LinearLayout>

                </LinearLayout>

            </LinearLayout>

        </LinearLayout>
    </android.support.v4.widget.SwipeRefreshLayout>
</android.support.constraint.ConstraintLayout>