<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:card_view="http://schemas.android.com/tools"
    android:clickable="true"
    android:focusable="true"
    android:paddingBottom="4dp">

    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:clickable="false"
        android:backgroundTint="@color/cardview_background"
        app:cardCornerRadius="2dp"
        app:layout_constraintBottom_toBottomOf="parent"
        card_view:cardElevation="@dimen/cardview_elevation">

        <LinearLayout
            android:id="@+id/mainLinear"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clickable="false"
            android:orientation="vertical"
            android:tag="mainLinear">

            <ProgressBar
                android:id="@+id/currencyPortfolioDominance"
                android:layout_width="match_parent"
                android:layout_height="2dp"
                style="@style/Widget.AppCompat.ProgressBar.Horizontal"
                android:visibility="invisible"/>

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

                <LinearLayout
                    android:id="@+id/topLayout"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <ImageView
                        android:id="@+id/currencyIcon"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="1dp" />

                    <TextView
                        android:id="@+id/currencyNameTextView"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_vertical"
                        android:gravity="start"
                        android:textColor="@color/mainTextViewColor"
                        android:textSize="@dimen/cardViewMainText" />

                    <TextView
                        android:id="@+id/currencySymbolTextView"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="2dp"
                        android:gravity="left"
                        android:textColor="@color/secondaryTextViewColor"
                        android:textSize="@dimen/cardViewSecondaryText" />

                    <TextView
                        android:id="@+id/currencyValueTextView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:gravity="right"
                        android:textColor="@color/secondaryTextViewColor"
                        android:textSize="@dimen/cardViewMainText" />

                </LinearLayout>

                <LinearLayout
                    android:id="@+id/bottomLayout"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/percentageOwnedTextView"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:gravity="start"
                        android:textColor="@color/secondaryTextViewColor"
                        android:textSize="@dimen/cardViewMainText"
                        android:visibility="gone"/>

                    <LinearLayout
                        android:id="@+id/currencyOwnedInfoLayout"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal">

                        <TextView
                            android:id="@+id/currencyOwnedTextView"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:gravity="start"
                            android:textColor="@color/mainTextViewColor"
                            android:textSize="@dimen/cardViewMainText" />

                        <TextView
                            android:id="@+id/currencyValueOwnedTextView"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginStart="2dp"
                            android:gravity="start"
                            android:textColor="@color/secondaryTextViewColor"
                            android:textSize="@dimen/cardViewSecondaryText" />

                    </LinearLayout>

                    <LinearLayout
                        android:id="@+id/secondaryLayout"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:gravity="end"
                        android:orientation="horizontal">

                        <TextView
                            android:id="@+id/currencyFluctuationPercentageTextView"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:textSize="@dimen/cardViewMainText" />

                        <TextView
                            android:id="@+id/currencyFluctuationTextView"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:textSize="@dimen/cardViewSecondaryText" />

                    </LinearLayout>

                </LinearLayout>

            </LinearLayout>

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

                <LinearLayout
                    android:id="@+id/separationLayout"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="5dp">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Day history"
                        android:textSize="@dimen/cardViewSecondaryText" />

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

                </LinearLayout>

                <FrameLayout
                    android:id="@+id/frameLayoutChart"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/cardViewChartSize"
                    android:clickable="true"
                    android:focusable="true">

                    <ProgressBar
                        android:id="@+id/progressLineChart"
                        android:layout_width="match_parent"
                        android:layout_height="150dp"
                        android:visibility="gone"/>

                    <com.github.mikephil.charting.charts.LineChart
                        android:id="@+id/LineChartView"
                        android:layout_width="match_parent"
                        android:layout_height="150dp"
                        android:visibility="visible"/>

                    <ImageView
                        android:id="@+id/detailsArrow"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:src="@drawable/ic_keyboard_arrow_right_grey_48dp"
                        android:layout_gravity="center_vertical|end"/>

                </FrameLayout>

            </LinearLayout>

        </LinearLayout>

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

</android.support.constraint.ConstraintLayout>