clean Sad's shit
This commit is contained in:
parent
84e300482a
commit
cc5b512441
53 changed files with 652 additions and 466 deletions
|
@ -48,7 +48,9 @@ class MangaReadAdapter(
|
|||
val bind = ItemAnimeWatchBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
return ViewHolder(bind)
|
||||
}
|
||||
|
||||
private var nestedDialog: AlertDialog? = null
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val binding = holder.binding
|
||||
|
@ -211,7 +213,8 @@ class MangaReadAdapter(
|
|||
dialogBinding.animeScanlatorTop.setOnClickListener {
|
||||
val dialogView2 =
|
||||
LayoutInflater.from(currContext()).inflate(R.layout.custom_dialog_layout, null)
|
||||
val checkboxContainer = dialogView2.findViewById<LinearLayout>(R.id.checkboxContainer)
|
||||
val checkboxContainer =
|
||||
dialogView2.findViewById<LinearLayout>(R.id.checkboxContainer)
|
||||
|
||||
// Dynamically add checkboxes
|
||||
options.forEach { option ->
|
||||
|
@ -248,12 +251,12 @@ class MangaReadAdapter(
|
|||
dialog.window?.setDimAmount(0.8f)
|
||||
}
|
||||
|
||||
nestedDialog = AlertDialog.Builder(fragment.requireContext() , R.style.MyPopup)
|
||||
nestedDialog = AlertDialog.Builder(fragment.requireContext(), R.style.MyPopup)
|
||||
.setTitle("Options")
|
||||
.setView(dialogView)
|
||||
.setPositiveButton("OK") { _, _ ->
|
||||
if(run) fragment.onIconPressed(style, reversed)
|
||||
if (dialogBinding.downloadNo.text != "0"){
|
||||
if (run) fragment.onIconPressed(style, reversed)
|
||||
if (dialogBinding.downloadNo.text != "0") {
|
||||
fragment.multiDownload(dialogBinding.downloadNo.text.toString().toInt())
|
||||
}
|
||||
}
|
||||
|
@ -293,6 +296,7 @@ class MangaReadAdapter(
|
|||
0
|
||||
)
|
||||
}
|
||||
|
||||
val startChapter = MangaNameAdapter.findChapterNumber(names[limit * (position)])
|
||||
val endChapter = MangaNameAdapter.findChapterNumber(names[last - 1])
|
||||
val startChapterString = if (startChapter != null) {
|
||||
|
@ -425,7 +429,8 @@ class MangaReadAdapter(
|
|||
parser.extension.sources.map { LanguageMapper.mapLanguageCodeToName(it.lang) }
|
||||
)
|
||||
val items = adapter.count
|
||||
if (items > 1) binding?.animeSourceLanguageContainer?.visibility = View.VISIBLE else binding?.animeSourceLanguageContainer?.visibility = View.GONE
|
||||
if (items > 1) binding?.animeSourceLanguageContainer?.visibility =
|
||||
View.VISIBLE else binding?.animeSourceLanguageContainer?.visibility = View.GONE
|
||||
|
||||
binding?.animeSourceLanguage?.setAdapter(adapter)
|
||||
|
||||
|
|
|
@ -197,12 +197,15 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
|
|||
override fun onScanlatorsSelected() {
|
||||
updateChapters()
|
||||
}
|
||||
|
||||
fun multiDownload(n: Int) {
|
||||
//get last viewed chapter
|
||||
val selected = media.userProgress
|
||||
val chapters = media.manga?.chapters?.values?.toList()
|
||||
//filter by selected language
|
||||
val progressChapterIndex = (chapters?.indexOfFirst { MangaNameAdapter.findChapterNumber(it.number)?.toInt() == selected } ?: 0) + 1
|
||||
val progressChapterIndex = (chapters?.indexOfFirst {
|
||||
MangaNameAdapter.findChapterNumber(it.number)?.toInt() == selected
|
||||
} ?: 0) + 1
|
||||
|
||||
if (progressChapterIndex < 0 || n < 1 || chapters == null) return
|
||||
|
||||
|
@ -363,7 +366,8 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
|
|||
if (allSettings.isNotEmpty()) {
|
||||
var selectedSetting = allSettings[0]
|
||||
if (allSettings.size > 1) {
|
||||
val names = allSettings.map { LanguageMapper.mapLanguageCodeToName(it.lang) }.toTypedArray()
|
||||
val names =
|
||||
allSettings.map { LanguageMapper.mapLanguageCodeToName(it.lang) }.toTypedArray()
|
||||
var selectedIndex = 0
|
||||
val dialog = AlertDialog.Builder(requireContext(), R.style.MyPopup)
|
||||
.setTitle("Select a Source")
|
||||
|
|
|
@ -89,7 +89,8 @@ abstract class BaseImageAdapter(
|
|||
}
|
||||
} else {
|
||||
val detector = GestureDetectorCompat(view.context, object : GesturesListener() {
|
||||
override fun onSingleClick(event: MotionEvent) = activity.handleController(event = event)
|
||||
override fun onSingleClick(event: MotionEvent) =
|
||||
activity.handleController(event = event)
|
||||
})
|
||||
view.findViewById<View>(R.id.imgProgCover).apply {
|
||||
setOnTouchListener { _, event ->
|
||||
|
|
|
@ -93,12 +93,14 @@ open class ImageAdapter(
|
|||
override fun getItemCount(): Int = images.size
|
||||
|
||||
override fun isZoomed(): Boolean {
|
||||
val imageView = activity.findViewById<SubsamplingScaleImageView>(R.id.imgProgImageNoGestures)
|
||||
val imageView =
|
||||
activity.findViewById<SubsamplingScaleImageView>(R.id.imgProgImageNoGestures)
|
||||
return imageView.scale > imageView.minScale
|
||||
}
|
||||
|
||||
override fun setZoom(zoom: Float) {
|
||||
val imageView = activity.findViewById<SubsamplingScaleImageView>(R.id.imgProgImageNoGestures)
|
||||
val imageView =
|
||||
activity.findViewById<SubsamplingScaleImageView>(R.id.imgProgImageNoGestures)
|
||||
imageView.setScaleAndCenter(zoom, imageView.center)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -255,7 +255,8 @@ class MangaReaderActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
showProgressDialog =
|
||||
if (settings.askIndividual) loadData<Boolean>("${media.id}_progressDialog")?: true else false
|
||||
if (settings.askIndividual) loadData<Boolean>("${media.id}_progressDialog")
|
||||
?: true else false
|
||||
|
||||
//Chapter Change
|
||||
fun change(index: Int) {
|
||||
|
@ -850,7 +851,8 @@ class MangaReaderActivity : AppCompatActivity() {
|
|||
private fun progress(runnable: Runnable) {
|
||||
if (maxChapterPage - currentChapterPage <= 1 && Anilist.userid != null) {
|
||||
showProgressDialog =
|
||||
if (settings.askIndividual) loadData<Boolean>("${media.id}_progressDialog")?: true else false
|
||||
if (settings.askIndividual) loadData<Boolean>("${media.id}_progressDialog")
|
||||
?: true else false
|
||||
if (showProgressDialog) {
|
||||
|
||||
val dialogView = layoutInflater.inflate(R.layout.item_custom_dialog, null)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue