Skip to content

Commit

Permalink
might have fixed #190
Browse files Browse the repository at this point in the history
  • Loading branch information
LagradOst committed Aug 17, 2023
1 parent 3bc8b08 commit 21cd118
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/com/lagradost/quicknovel/BookDownloader2.kt
Original file line number Diff line number Diff line change
Expand Up @@ -563,17 +563,17 @@ object BookDownloader2Helper {
maxTries: Int = 5
): Boolean = withContext(Dispatchers.IO) {
val rFile = File(filepath)
if (rFile.exists() && !forceReload) {
if (rFile.exists() && rFile.length() > 0 && !forceReload) {
return@withContext true
}
rFile.parentFile?.mkdirs()
if (rFile.isDirectory) rFile.delete()
rFile.createNewFile()

for (i in 0..maxTries) {
val page = api.loadHtml(data.url)

if (page != null) {
if (!page.isNullOrBlank()) {
rFile.createNewFile() // only create the file when actually needed
rFile.writeText("${data.name}\n${page}")
return@withContext true
} else {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/lagradost/quicknovel/ReadActivity2.kt
Original file line number Diff line number Diff line change
Expand Up @@ -953,12 +953,12 @@ class ReadActivity2 : AppCompatActivity(), ColorPickerDialogListener {
if (event.historySize <= 1) return@setOnTouchListener false
val start = event.getHistoricalY(0, event.historySize - 1)
val end = event.getY(0)
val dy = (end - start).div(Resources.getSystem().displayMetrics.density).coerceIn(-2.0f,2.0f)
val dy = (end - start).div(Resources.getSystem().displayMetrics.density).coerceIn(-1.5f,1.5f)
// if cant scroll in the direction then translate Y with the dy
val translated = !canScrollVertically(-1) || !canScrollVertically(1)
if (translated) {
// * (maxScrollOver - currentOverScroll.absoluteValue))
currentOverScroll += dy * 0.4f
currentOverScroll += dy * 0.3f
}

// if we can scroll down then we cant translate down
Expand Down

0 comments on commit 21cd118

Please sign in to comment.