LibreTube/app/src/main/res/layout/downloaded_media_row.xml
Krunal Patel 4f0f9b7560 Fix notification action, download fragment and resource leak
- Bind service when service started using notification resume action.

- Use `HttpURLConnection` to download file.

- Use progress bar to determine overall progress.
2022-12-21 21:41:37 +05:30

93 lines
3.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<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:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:orientation="horizontal"
android:paddingHorizontal="10dp"
android:paddingVertical="8dp">
<com.google.android.material.card.MaterialCardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="15dp"
app:cardCornerRadius="8dp">
<ImageView
android:id="@+id/thumbnailImage"
android:layout_width="140dp"
android:layout_height="80dp"
android:scaleType="fitXY"
tools:src="@tools:sample/backgrounds/scenic" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/downloadOverlay"
android:layout_width="140dp"
android:layout_height="80dp"
android:background="#BF000000">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="52dp"
android:layout_height="52dp"
android:indeterminateOnly="false"
android:progressDrawable="@drawable/circular_progress"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/resumePauseBtn"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_download"
app:layout_constraintBottom_toBottomOf="@id/progressBar"
app:layout_constraintLeft_toLeftOf="@id/progressBar"
app:layout_constraintRight_toRightOf="@id/progressBar"
app:layout_constraintTop_toTopOf="@id/progressBar" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="2dp"
android:maxLines="2"
android:textSize="16sp" />
<TextView
android:id="@+id/uploaderName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="2dp"
android:textSize="12sp" />
<TextView
android:id="@+id/videoInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="2dp"
android:textSize="12sp" />
</LinearLayout>
<TextView
android:id="@+id/fileSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
</LinearLayout>