Merge branch 'main' of https://github.com/rebelonion/Dantotsu
This commit is contained in:
commit
a93b4f5b11
4 changed files with 40 additions and 19 deletions
|
@ -232,12 +232,18 @@ class MangaDownloaderService : Service() {
|
||||||
image.page,
|
image.page,
|
||||||
image.source
|
image.source
|
||||||
)
|
)
|
||||||
|
if (bitmap == null) {
|
||||||
|
snackString("${task.chapter} - Retrying to download page ${index.ofLength(3)}, attempt ${retryCount + 1}.")
|
||||||
|
}
|
||||||
retryCount++
|
retryCount++
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bitmap != null) {
|
if (bitmap == null) {
|
||||||
saveToDisk("${index.ofLength(3)}.jpg", outputDir, bitmap)
|
outputDir.deleteRecursively(this@MangaDownloaderService, false)
|
||||||
|
throw Exception("${task.chapter} - Unable to download all pages after $retryCount attempts. Try again.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
saveToDisk("${index.ofLength(3)}.jpg", outputDir, bitmap)
|
||||||
farthest++
|
farthest++
|
||||||
|
|
||||||
builder.setProgress(task.imageData.size, farthest, false)
|
builder.setProgress(task.imageData.size, farthest, false)
|
||||||
|
|
|
@ -7,9 +7,11 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
import android.widget.CheckBox
|
import android.widget.CheckBox
|
||||||
|
import android.widget.EditText
|
||||||
import android.widget.ImageButton
|
import android.widget.ImageButton
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.NumberPicker
|
import android.widget.NumberPicker
|
||||||
|
import android.widget.TextView
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.content.ContextCompat.getString
|
import androidx.core.content.ContextCompat.getString
|
||||||
import androidx.core.content.ContextCompat.startActivity
|
import androidx.core.content.ContextCompat.startActivity
|
||||||
|
@ -265,19 +267,22 @@ class MangaReadAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multi download
|
// Multi download
|
||||||
downloadNo.text = "0"
|
//downloadNo.text = "0"
|
||||||
mediaDownloadTop.setOnClickListener {
|
mediaDownloadTop.setOnClickListener {
|
||||||
// Alert dialog asking for the number of chapters to download
|
|
||||||
fragment.requireContext().customAlertDialog().apply {
|
fragment.requireContext().customAlertDialog().apply {
|
||||||
setTitle("Multi Chapter Downloader")
|
setTitle("Multi Chapter Downloader")
|
||||||
setMessage("Enter the number of chapters to download")
|
setMessage("Enter the number of chapters to download")
|
||||||
val input = NumberPicker(currContext())
|
val input = View.inflate(currContext(), R.layout.dialog_layout, null)
|
||||||
input.minValue = 1
|
val editText = input.findViewById<EditText>(R.id.downloadNo)
|
||||||
input.maxValue = 20
|
|
||||||
input.value = 1
|
|
||||||
setCustomView(input)
|
setCustomView(input)
|
||||||
setPosButton(R.string.ok) {
|
setPosButton(R.string.ok) {
|
||||||
downloadNo.text = "${input.value}"
|
val value = editText.text.toString().toIntOrNull()
|
||||||
|
if (value != null && value > 0) {
|
||||||
|
downloadNo.setText(value.toString(), TextView.BufferType.EDITABLE)
|
||||||
|
fragment.multiDownload(value)
|
||||||
|
} else {
|
||||||
|
toast("Please enter a valid number")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setNegButton(R.string.cancel)
|
setNegButton(R.string.cancel)
|
||||||
show()
|
show()
|
||||||
|
@ -382,8 +387,9 @@ class MangaReadAdapter(
|
||||||
setCustomView(root)
|
setCustomView(root)
|
||||||
setPosButton("OK") {
|
setPosButton("OK") {
|
||||||
if (run) fragment.onIconPressed(style, reversed)
|
if (run) fragment.onIconPressed(style, reversed)
|
||||||
if (downloadNo.text != "0") {
|
val value = downloadNo.text.toString().toIntOrNull()
|
||||||
fragment.multiDownload(downloadNo.text.toString().toInt())
|
if (value != null && value > 0) {
|
||||||
|
fragment.multiDownload(value)
|
||||||
}
|
}
|
||||||
if (refresh) fragment.loadChapters(source, true)
|
if (refresh) fragment.loadChapters(source, true)
|
||||||
}
|
}
|
||||||
|
|
|
@ -474,7 +474,7 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
|
||||||
scanlator = chapter.scanlator ?: "Unknown",
|
scanlator = chapter.scanlator ?: "Unknown",
|
||||||
imageData = images,
|
imageData = images,
|
||||||
sourceMedia = media,
|
sourceMedia = media,
|
||||||
retries = 2,
|
retries = 25,
|
||||||
simultaneousDownloads = 2
|
simultaneousDownloads = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
android:padding="16dp">
|
android:padding="16dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="326dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
@ -160,8 +160,8 @@
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="265dp"
|
android:layout_width="263dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="60dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -171,14 +171,23 @@
|
||||||
android:fontFamily="@font/poppins_bold"
|
android:fontFamily="@font/poppins_bold"
|
||||||
android:text="@string/download" />
|
android:text="@string/download" />
|
||||||
|
|
||||||
<TextView
|
<EditText
|
||||||
android:id="@+id/downloadNo"
|
android:id="@+id/downloadNo"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:fontFamily="@font/poppins_bold"
|
android:fontFamily="@font/poppins_bold"
|
||||||
android:textColor="?attr/colorSecondary"
|
android:textColor="?attr/colorSecondary"
|
||||||
|
android:textSize="12dp"
|
||||||
tools:ignore="TextContrastCheck"
|
tools:ignore="TextContrastCheck"
|
||||||
tools:text="number" />
|
tools:text="Number" />
|
||||||
|
<!-- <TextView-->
|
||||||
|
<!-- android:id="@+id/downloadNo"-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:fontFamily="@font/poppins_bold"-->
|
||||||
|
<!-- android:textColor="?attr/colorSecondary"-->
|
||||||
|
<!-- tools:ignore="TextContrastCheck"-->
|
||||||
|
<!-- tools:text="number" />-->
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
|
@ -191,7 +200,7 @@
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/mediaDownloadTop"
|
android:id="@+id/mediaDownloadTop"
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="60dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
app:srcCompat="@drawable/ic_download_24"
|
app:srcCompat="@drawable/ic_download_24"
|
||||||
app:tint="?attr/colorOnBackground"
|
app:tint="?attr/colorOnBackground"
|
||||||
|
@ -313,9 +322,9 @@
|
||||||
android:text="@string/reset" />
|
android:text="@string/reset" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/reset_progress_def"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/reset_progress_def"
|
|
||||||
android:fontFamily="@font/poppins_bold"
|
android:fontFamily="@font/poppins_bold"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textColor="?attr/colorSecondary"
|
android:textColor="?attr/colorSecondary"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue