hotfixes
This commit is contained in:
parent
1ed09133bc
commit
d5824f59d3
8 changed files with 62 additions and 38 deletions
|
|
@ -20,6 +20,7 @@ import com.google.android.material.button.MaterialButton
|
||||||
import com.google.android.material.card.MaterialCardView
|
import com.google.android.material.card.MaterialCardView
|
||||||
import com.google.android.material.progressindicator.LinearProgressIndicator
|
import com.google.android.material.progressindicator.LinearProgressIndicator
|
||||||
import com.squareup.picasso.Picasso
|
import com.squareup.picasso.Picasso
|
||||||
|
import org.w3c.dom.Text
|
||||||
import java.util.zip.GZIPOutputStream
|
import java.util.zip.GZIPOutputStream
|
||||||
|
|
||||||
class ActiveDownloadAdapter(onItemClickListener: OnItemClickListener, activity: Activity) : ListAdapter<DownloadItem?, ActiveDownloadAdapter.ViewHolder>(AsyncDifferConfig.Builder(DIFF_CALLBACK).build()) {
|
class ActiveDownloadAdapter(onItemClickListener: OnItemClickListener, activity: Activity) : ListAdapter<DownloadItem?, ActiveDownloadAdapter.ViewHolder>(AsyncDifferConfig.Builder(DIFF_CALLBACK).build()) {
|
||||||
|
|
@ -84,6 +85,9 @@ class ActiveDownloadAdapter(onItemClickListener: OnItemClickListener, activity:
|
||||||
}
|
}
|
||||||
author.text = info
|
author.text = info
|
||||||
|
|
||||||
|
val type = card.findViewById<TextView>(R.id.type)
|
||||||
|
type.text = item.type.toString().uppercase()
|
||||||
|
|
||||||
val formatNote = card.findViewById<TextView>(R.id.format_note)
|
val formatNote = card.findViewById<TextView>(R.id.format_note)
|
||||||
formatNote.text = item.format.format_note
|
formatNote.text = item.format.format_note
|
||||||
val codec = card.findViewById<TextView>(R.id.codec)
|
val codec = card.findViewById<TextView>(R.id.codec)
|
||||||
|
|
|
||||||
|
|
@ -68,13 +68,13 @@ class DownloadViewModel(application: Application) : AndroidViewModel(application
|
||||||
|
|
||||||
val audioContainer = sharedPreferences.getString("audio_format", "mp3")
|
val audioContainer = sharedPreferences.getString("audio_format", "mp3")
|
||||||
bestAudioFormat = Format(
|
bestAudioFormat = Format(
|
||||||
"",
|
getApplication<App>().resources.getString(R.string.best_quality),
|
||||||
audioContainer!!,
|
audioContainer!!,
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
0,
|
0,
|
||||||
""
|
getApplication<App>().resources.getString(R.string.best_quality)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -209,8 +209,9 @@ class DownloadViewModel(application: Application) : AndroidViewModel(application
|
||||||
|
|
||||||
fun turnResultItemsToDownloadItems(items: List<ResultItem?>) : List<DownloadItem> {
|
fun turnResultItemsToDownloadItems(items: List<ResultItem?>) : List<DownloadItem> {
|
||||||
val list : MutableList<DownloadItem> = mutableListOf()
|
val list : MutableList<DownloadItem> = mutableListOf()
|
||||||
|
val preferredType = sharedPreferences.getString("preferred_download_type", "video");
|
||||||
items.forEach {
|
items.forEach {
|
||||||
list.add(createDownloadItemFromResult(it!!, Type.video))
|
list.add(createDownloadItemFromResult(it!!, Type.valueOf(preferredType!!)))
|
||||||
}
|
}
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ class DownloadWorker(
|
||||||
DownloadViewModel.Type.audio -> {
|
DownloadViewModel.Type.audio -> {
|
||||||
request.addOption("-x")
|
request.addOption("-x")
|
||||||
var audioQualityId : String = downloadItem.format.format_id
|
var audioQualityId : String = downloadItem.format.format_id
|
||||||
if (audioQualityId.isEmpty() || audioQualityId == "0") audioQualityId = ""
|
if (audioQualityId.isEmpty() || audioQualityId == "0" || audioQualityId == context.getString(R.string.best_quality)) audioQualityId = ""
|
||||||
if (audioQualityId.isNotEmpty()){
|
if (audioQualityId.isNotEmpty()){
|
||||||
request.addOption("-f", audioQualityId)
|
request.addOption("-f", audioQualityId)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/linearLayout2"
|
app:layout_constraintBottom_toTopOf="@+id/linearlayout2_horizontalscrollview"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/active_download_cancel"
|
app:layout_constraintEnd_toStartOf="@+id/active_download_cancel"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
@ -96,47 +96,65 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.chip.ChipGroup
|
<HorizontalScrollView
|
||||||
android:id="@+id/linearLayout2"
|
android:id="@+id/linearlayout2_horizontalscrollview"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingHorizontal="10dp"
|
android:scrollbars="none"
|
||||||
android:layout_gravity="bottom"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/output"
|
app:layout_constraintBottom_toTopOf="@+id/output"
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
<com.google.android.material.chip.Chip
|
<com.google.android.material.chip.ChipGroup
|
||||||
android:id="@+id/format_note"
|
android:id="@+id/linearLayout2"
|
||||||
style="@style/Widget.Material3.FloatingActionButton.Large.Secondary"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clickable="false"
|
android:paddingHorizontal="10dp"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/output"
|
android:layout_gravity="bottom"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<com.google.android.material.chip.Chip
|
||||||
|
android:id="@+id/type"
|
||||||
|
style="@style/Widget.Material3.FloatingActionButton.Large.Secondary"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clickable="false"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/output"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<com.google.android.material.chip.Chip
|
||||||
|
android:id="@+id/format_note"
|
||||||
|
style="@style/Widget.Material3.FloatingActionButton.Large.Secondary"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clickable="false"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.chip.Chip
|
<com.google.android.material.chip.Chip
|
||||||
android:id="@+id/codec"
|
android:id="@+id/codec"
|
||||||
style="@style/Widget.Material3.FloatingActionButton.Large.Secondary"
|
style="@style/Widget.Material3.FloatingActionButton.Large.Secondary"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<com.google.android.material.chip.Chip
|
<com.google.android.material.chip.Chip
|
||||||
android:id="@+id/file_size"
|
android:id="@+id/file_size"
|
||||||
style="@style/Widget.Material3.FloatingActionButton.Large.Tertiary"
|
style="@style/Widget.Material3.FloatingActionButton.Large.Tertiary"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
</com.google.android.material.chip.ChipGroup>
|
</com.google.android.material.chip.ChipGroup>
|
||||||
|
|
||||||
|
</HorizontalScrollView>
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
android:checkable="true"
|
android:checkable="true"
|
||||||
app:cardCornerRadius="10dp"
|
app:cardCornerRadius="10dp"
|
||||||
app:cardMaxElevation="12dp"
|
app:cardMaxElevation="12dp"
|
||||||
|
app:cardElevation="5dp"
|
||||||
app:cardPreventCornerOverlap="true"
|
app:cardPreventCornerOverlap="true"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:cardCornerRadius="10dp"
|
app:cardCornerRadius="10dp"
|
||||||
app:cardElevation="10dp"
|
app:cardElevation="5dp"
|
||||||
app:cardMaxElevation="12dp"
|
app:cardMaxElevation="12dp"
|
||||||
android:checkable="true"
|
android:checkable="true"
|
||||||
app:strokeWidth="0dp"
|
app:strokeWidth="0dp"
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:cardCornerRadius="10dp"
|
app:cardCornerRadius="10dp"
|
||||||
app:cardElevation="10dp"
|
app:cardElevation="5dp"
|
||||||
app:cardMaxElevation="12dp"
|
app:cardMaxElevation="12dp"
|
||||||
app:cardPreventCornerOverlap="true"
|
app:cardPreventCornerOverlap="true"
|
||||||
android:checkable="true"
|
android:checkable="true"
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@
|
||||||
app:title="@string/audio_quality" />
|
app:title="@string/audio_quality" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:defaultValue="Best Quality"
|
android:defaultValue="@string/best_quality"
|
||||||
android:entries="@array/video_formats"
|
android:entries="@array/video_formats"
|
||||||
android:entryValues="@array/video_formats"
|
android:entryValues="@array/video_formats"
|
||||||
android:icon="@drawable/ic_video"
|
android:icon="@drawable/ic_video"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue