<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (c) 2023 Samson Achiaga
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<layout 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">

    <data>

        <import type="com.certified.audionote.utils.Extensions" />

        <import type="com.certified.audionote.utils.UtilKt" />

        <variable
            name="note"
            type="com.certified.audionote.model.Note" />
    </data>

    <com.google.android.material.card.MaterialCardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:cardBackgroundColor="@{note.color}"
        app:cardCornerRadius="@dimen/_8sdp"
        app:cardElevation="@dimen/_4sdp"
        app:cardUseCompatPadding="true">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@{note.color}"
            android:paddingBottom="@dimen/_8sdp">

            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/tv_note_title"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="@dimen/_8sdp"
                android:layout_marginTop="@dimen/_8sdp"
                android:layout_marginEnd="@dimen/_4sdp"
                android:ellipsize="end"
                android:fontFamily="@font/open_sans_bold"
                android:maxLines="1"
                android:text="@{note.title}"
                android:textColor="@color/white"
                android:textSize="@dimen/_12ssp"
                app:layout_constraintEnd_toStartOf="@+id/tv_note_last_modification_date"
                app:layout_constraintHorizontal_bias="0.5"
                app:layout_constraintHorizontal_chainStyle="spread_inside"
                app:layout_constraintHorizontal_weight="4"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                tools:text="CPE 407 - Lecture 1" />

            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/tv_note_last_modification_date"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginEnd="@dimen/_8sdp"
                android:ellipsize="end"
                android:fontFamily="@font/open_sans_regular"
                android:maxLines="1"
                android:text="@{UtilKt.formatDate(note.lastModificationDate, context)}"
                android:textAlignment="viewEnd"
                android:textColor="@color/white"
                android:textSize="@dimen/_10ssp"
                app:layout_constraintBottom_toBottomOf="@+id/tv_note_title"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="0.5"
                app:layout_constraintHorizontal_weight="2"
                app:layout_constraintStart_toEndOf="@+id/tv_note_title"
                app:layout_constraintTop_toTopOf="@+id/tv_note_title"
                tools:text="17/11/21" />

            <androidx.appcompat.widget.AppCompatImageButton
                android:id="@+id/appCompatImageView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/_8sdp"
                android:background="@null"
                android:padding="@dimen/_4sdp"
                android:tint="@color/white"
                app:layout_constraintEnd_toStartOf="@+id/tv_record_length"
                app:layout_constraintHorizontal_bias="0.5"
                app:layout_constraintHorizontal_chainStyle="spread_inside"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/tv_note_title"
                app:srcCompat="@drawable/ic_mic_black_24dp" />

            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/tv_record_length"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:fontFamily="@font/open_sans_bold"
                android:textColor="@color/white"
                android:textSize="@dimen/_12ssp"
                app:layout_constraintBottom_toBottomOf="@+id/appCompatImageView"
                app:layout_constraintEnd_toStartOf="@+id/tv_note_size"
                app:layout_constraintHorizontal_bias="0.5"
                app:layout_constraintStart_toEndOf="@+id/appCompatImageView"
                app:layout_constraintTop_toTopOf="@+id/appCompatImageView"
                app:timeText="@{note.audioLength}"
                tools:text="36:25" />

            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/tv_note_size"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:fontFamily="@font/open_sans_regular"
                android:textColor="@color/white"
                android:textSize="@dimen/_12ssp"
                app:layout_constraintEnd_toEndOf="@+id/tv_note_last_modification_date"
                app:layout_constraintHorizontal_bias="0.5"
                app:layout_constraintStart_toEndOf="@+id/tv_record_length"
                app:layout_constraintTop_toTopOf="@+id/tv_record_length"
                app:sizeText="@{note.size}"
                tools:text="46MB" />

            <androidx.appcompat.widget.AppCompatImageButton
                android:id="@+id/appCompatImageView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/_8sdp"
                android:alpha=".6"
                android:background="@null"
                android:padding="@dimen/_4sdp"
                android:tint="@color/white"
                app:layout_constraintStart_toStartOf="@+id/appCompatImageView"
                app:layout_constraintTop_toBottomOf="@+id/appCompatImageView"
                app:srcCompat="@drawable/ic_alarm_on_black_24dp" />

            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/tv_reminder_time"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="@dimen/_4sdp"
                android:alpha=".6"
                android:ellipsize="end"
                android:fontFamily="@font/open_sans_regular"
                android:maxLines="1"
                android:text="@{UtilKt.formatReminderDate(note.reminder)}"
                android:textAlignment="textEnd"
                android:textColor="@color/white"
                android:textSize="@dimen/_12ssp"
                app:layout_constraintBottom_toBottomOf="@+id/appCompatImageView2"
                app:layout_constraintEnd_toEndOf="@+id/tv_note_size"
                app:layout_constraintStart_toEndOf="@+id/appCompatImageView2"
                app:layout_constraintTop_toTopOf="@+id/appCompatImageView2"
                app:strikeThrough="@{UtilKt.currentDate().timeInMillis > note.reminder}"
                app:visible="@{note.reminder != null}" />
            <!--            tools:text="17 Nov, 2021 8:00 AM"-->

            <com.google.android.material.textview.MaterialTextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="@dimen/_4sdp"
                android:ellipsize="end"
                android:fontFamily="@font/open_sans_regular"
                android:maxLines="1"
                android:text="@string/no_reminder_set"
                android:textAlignment="viewEnd"
                android:textColor="@color/white"
                android:textSize="@dimen/_12ssp"
                app:layout_constraintBottom_toBottomOf="@+id/appCompatImageView2"
                app:layout_constraintEnd_toEndOf="@+id/tv_note_size"
                app:layout_constraintStart_toEndOf="@+id/appCompatImageView2"
                app:layout_constraintTop_toTopOf="@+id/appCompatImageView2"
                app:visible="@{note.reminder == null}" />

        </androidx.constraintlayout.widget.ConstraintLayout>

    </com.google.android.material.card.MaterialCardView>
</layout>