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.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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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