To install multiple mangas (#582)
users can enter the value required to install as there is an EditText field instead of the Text View
This commit is contained in:
parent
6c49839f87
commit
a684aac0b1
2 changed files with 31 additions and 16 deletions
|
@ -7,9 +7,11 @@ import android.view.View
|
|||
import android.view.ViewGroup
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.CheckBox
|
||||
import android.widget.EditText
|
||||
import android.widget.ImageButton
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.NumberPicker
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.ContextCompat.getString
|
||||
import androidx.core.content.ContextCompat.startActivity
|
||||
|
@ -265,19 +267,22 @@ class MangaReadAdapter(
|
|||
}
|
||||
|
||||
// Multi download
|
||||
downloadNo.text = "0"
|
||||
//downloadNo.text = "0"
|
||||
mediaDownloadTop.setOnClickListener {
|
||||
// Alert dialog asking for the number of chapters to download
|
||||
fragment.requireContext().customAlertDialog().apply {
|
||||
setTitle("Multi Chapter Downloader")
|
||||
setMessage("Enter the number of chapters to download")
|
||||
val input = NumberPicker(currContext())
|
||||
input.minValue = 1
|
||||
input.maxValue = 20
|
||||
input.value = 1
|
||||
val input = View.inflate(currContext(), R.layout.dialog_layout, null)
|
||||
val editText = input.findViewById<EditText>(R.id.downloadNo)
|
||||
setCustomView(input)
|
||||
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)
|
||||
show()
|
||||
|
@ -382,8 +387,9 @@ class MangaReadAdapter(
|
|||
setCustomView(root)
|
||||
setPosButton("OK") {
|
||||
if (run) fragment.onIconPressed(style, reversed)
|
||||
if (downloadNo.text != "0") {
|
||||
fragment.multiDownload(downloadNo.text.toString().toInt())
|
||||
val value = downloadNo.text.toString().toIntOrNull()
|
||||
if (value != null && value > 0) {
|
||||
fragment.multiDownload(value)
|
||||
}
|
||||
if (refresh) fragment.loadChapters(source, true)
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
android:padding="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="326dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
@ -160,8 +160,8 @@
|
|||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="265dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="263dp"
|
||||
android:layout_height="60dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
|
@ -171,14 +171,23 @@
|
|||
android:fontFamily="@font/poppins_bold"
|
||||
android:text="@string/download" />
|
||||
|
||||
<TextView
|
||||
<EditText
|
||||
android:id="@+id/downloadNo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:textColor="?attr/colorSecondary"
|
||||
android:textSize="12dp"
|
||||
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>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
|
@ -191,7 +200,7 @@
|
|||
<ImageButton
|
||||
android:id="@+id/mediaDownloadTop"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_height="60dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
app:srcCompat="@drawable/ic_download_24"
|
||||
app:tint="?attr/colorOnBackground"
|
||||
|
@ -313,9 +322,9 @@
|
|||
android:text="@string/reset" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reset_progress_def"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/reset_progress_def"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:text=""
|
||||
android:textColor="?attr/colorSecondary"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue