mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 09:31:49 +01:00
Fixed webtoon page
This commit is contained in:
parent
414b8c9f21
commit
8ff8ab4f27
@ -64,7 +64,7 @@ class ImageNotifier(private val context: Context) {
|
|||||||
}
|
}
|
||||||
setContentTitle(context.getString(R.string.picture_saved))
|
setContentTitle(context.getString(R.string.picture_saved))
|
||||||
setSmallIcon(R.drawable.ic_insert_photo_black_24dp)
|
setSmallIcon(R.drawable.ic_insert_photo_black_24dp)
|
||||||
Glide.with(context).load(file).asBitmap().into(object : SimpleTarget<Bitmap>(100, 100) {
|
Glide.with(context).load(file).asBitmap().into(object : SimpleTarget<Bitmap>(96, 96) {
|
||||||
/**
|
/**
|
||||||
* The method that will be called when the resource load has finished.
|
* The method that will be called when the resource load has finished.
|
||||||
* @param resource the loaded resource.
|
* @param resource the loaded resource.
|
||||||
@ -74,7 +74,7 @@ class ImageNotifier(private val context: Context) {
|
|||||||
context.notificationManager.notify(notificationId, notificationBuilder.build())
|
context.notificationManager.notify(notificationId, notificationBuilder.build())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Glide.with(context).load(file).asBitmap().into(object : SimpleTarget<Bitmap>(512, 384) {
|
Glide.with(context).load(file).asBitmap().into(object : SimpleTarget<Bitmap>(720, 1280) {
|
||||||
/**
|
/**
|
||||||
* The method that will be called when the resource load has finished.
|
* The method that will be called when the resource load has finished.
|
||||||
* @param resource the loaded resource.
|
* @param resource the loaded resource.
|
||||||
|
@ -228,16 +228,16 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
|
|||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onLongPress() {
|
fun onLongPress(page: Page) {
|
||||||
MaterialDialog.Builder(this).apply {
|
MaterialDialog.Builder(this).apply {
|
||||||
title = "Choose"
|
title = "Choose"
|
||||||
items(R.array.reader_image_options)
|
items(R.array.reader_image_options)
|
||||||
.itemsIds(R.array.reader_image_options_values)
|
.itemsIds(R.array.reader_image_options_values)
|
||||||
itemsCallback { materialDialog, view, i, charSequence ->
|
itemsCallback { materialDialog, view, i, charSequence ->
|
||||||
when (i) {
|
when (i) {
|
||||||
0 -> presenter.setCover()
|
0 -> presenter.setCover(page)
|
||||||
1 -> presenter.shareImage()
|
1 -> presenter.shareImage(page)
|
||||||
2 -> presenter.savePage()
|
2 -> presenter.savePage(page)
|
||||||
}
|
}
|
||||||
|
|
||||||
}.show()
|
}.show()
|
||||||
|
@ -547,11 +547,10 @@ class ReaderPresenter : BasePresenter<ReaderActivity>() {
|
|||||||
/**
|
/**
|
||||||
* Update cover with page file.
|
* Update cover with page file.
|
||||||
*/
|
*/
|
||||||
internal fun setCover() {
|
internal fun setCover(page: Page) {
|
||||||
chapter.pages?.get(chapter.last_page_read)?.let {
|
|
||||||
// Update cover to selected file, show error if something went wrong
|
// Update cover to selected file, show error if something went wrong
|
||||||
try {
|
try {
|
||||||
if (editCoverWithStream(File(it.imagePath).inputStream(), manga)) {
|
if (editCoverWithStream(File(page.imagePath).inputStream(), manga)) {
|
||||||
context.toast(R.string.cover_updated)
|
context.toast(R.string.cover_updated)
|
||||||
} else {
|
} else {
|
||||||
throw Exception("Stream copy failed")
|
throw Exception("Stream copy failed")
|
||||||
@ -561,7 +560,6 @@ class ReaderPresenter : BasePresenter<ReaderActivity>() {
|
|||||||
Timber.e(e.message)
|
Timber.e(e.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to copy image to cache
|
* Called to copy image to cache
|
||||||
@ -578,8 +576,7 @@ class ReaderPresenter : BasePresenter<ReaderActivity>() {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun shareImage() {
|
fun shareImage(page: Page) {
|
||||||
chapter.pages?.get(chapter.last_page_read)?.let { page ->
|
|
||||||
val shareIntent = Intent().apply {
|
val shareIntent = Intent().apply {
|
||||||
action = Intent.ACTION_SEND
|
action = Intent.ACTION_SEND
|
||||||
putExtra(Intent.EXTRA_STREAM, Uri.parse(page.imagePath))
|
putExtra(Intent.EXTRA_STREAM, Uri.parse(page.imagePath))
|
||||||
@ -589,15 +586,13 @@ class ReaderPresenter : BasePresenter<ReaderActivity>() {
|
|||||||
context.startActivity(Intent.createChooser(shareIntent, context.resources.getText(R.string.action_share))
|
context.startActivity(Intent.createChooser(shareIntent, context.resources.getText(R.string.action_share))
|
||||||
.apply { flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK })
|
.apply { flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK })
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save page to local storage
|
* Save page to local storage
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
internal fun savePage() {
|
internal fun savePage(page: Page) {
|
||||||
chapter.pages?.get(chapter.last_page_read)?.let { page ->
|
|
||||||
// Location of image file.
|
// Location of image file.
|
||||||
val inputFile = File(page.imagePath)
|
val inputFile = File(page.imagePath)
|
||||||
|
|
||||||
@ -627,4 +622,3 @@ class ReaderPresenter : BasePresenter<ReaderActivity>() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -188,7 +188,7 @@ abstract class PagerReader : BaseReader() {
|
|||||||
|
|
||||||
override fun onLongPress(e: MotionEvent?) {
|
override fun onLongPress(e: MotionEvent?) {
|
||||||
super.onLongPress(e)
|
super.onLongPress(e)
|
||||||
readerActivity.onLongPress()
|
readerActivity.onLongPress(adapter.pages!![pager.currentItem])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -141,9 +141,11 @@ class WebtoonReader : BaseReader() {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onLongPress(e: MotionEvent?) {
|
override fun onLongPress(e: MotionEvent) {
|
||||||
super.onLongPress(e)
|
super.onLongPress(e)
|
||||||
readerActivity.onLongPress()
|
val a = recycler.findChildViewUnder(e.rawX, e.rawY)
|
||||||
|
val i = recycler.getChildAdapterPosition(a)
|
||||||
|
readerActivity.onLongPress(adapter.getItem(i))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user