This commit is contained in:
lunaticbum 2024-08-07 16:18:36 +09:00
parent 55a0b209ec
commit 536e917b29
3 changed files with 63 additions and 29 deletions

View File

@ -261,6 +261,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
} }
fun showHistory(infos: List<HistoryItem>) { fun showHistory(infos: List<HistoryItem>) {
val builderSingle: AlertDialog.Builder = AlertDialog.Builder(this@Intro) val builderSingle: AlertDialog.Builder = AlertDialog.Builder(this@Intro)
builderSingle.setTitle("${currentTitle} : ${currentChapter} -> Select One ") builderSingle.setTitle("${currentTitle} : ${currentChapter} -> Select One ")
val arrayAdapter = val arrayAdapter =
@ -491,7 +492,23 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
currentBooinfo = it currentBooinfo = it
paged_layer.text = it!!.contents!! paged_layer.text = it!!.contents!!
paged_layer.visibility = VISIBLE paged_layer.visibility = VISIBLE
if(it?.pathUrl?.length ?: 0 > 0) {
HistoryManager.save(historyItem = HistoryItem().putHistory(it,mBaseWebContentsViewer.webview.url!!))
Blog.LOGE("HistoryManager.getNextPage(${it?.pathUrl})")
if (lastInfo?.pageUrl?.length ?: 0 > 0 && lastInfo?.pageUrl!!.startsWith("http")) {
Blog.LOGE("HistoryManager.getNextPage(${lastInfo?.pageUrl})")
mBaseWebContentsViewer.webview.loadUrl(lastInfo!!.pageUrl!!.replace(Uri.parse(lastInfo!!.pageUrl)!!.path!!,it?.pathUrl!!))
} else {
Blog.LOGE("HistoryManager.getNextPage(${Booktoki.getLastedDoamin()})")
mBaseWebContentsViewer.webview.loadUrl(Booktoki.getLastedDoamin() + it?.pathUrl!!)
} }
it?.pathUrl?.let {
HistoryManager.getBooInfo(it) {
saveItem(it)
}
}
}
} else {
if(it?.pathUrl?.length ?: 0 > 0) { if(it?.pathUrl?.length ?: 0 > 0) {
HistoryManager.save(historyItem = HistoryItem().putHistory(it,mBaseWebContentsViewer.webview.url!!)) HistoryManager.save(historyItem = HistoryItem().putHistory(it,mBaseWebContentsViewer.webview.url!!))
Blog.LOGE("HistoryManager.getNextPage(${it?.pathUrl})") Blog.LOGE("HistoryManager.getNextPage(${it?.pathUrl})")
@ -511,6 +528,8 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
} }
} }
} }
}
} }
} }
// onNextClickAction?.let { it() } // onNextClickAction?.let { it() }

View File

@ -153,7 +153,7 @@ class PagedTextView : AppCompatTextView {
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh) super.onSizeChanged(w, h, oldw, oldh)
Blog.LOGD(log = "onSizeChanged>> ${this::class.java.name}") Blog.LOGD(log = "onSizeChanged>> ${this::class.java.name}")
pageHeight = ((h - (marginTop + marginBottom + paddingTop + paddingBottom)) * 0.85f).toInt() pageHeight = ((h - (marginTop + marginBottom + paddingTop + paddingBottom)) * 0.8f).toInt()
} }
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) { override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {

View File

@ -2,12 +2,14 @@ package com.mime.dualscreenview.webcontents
import android.app.AlertDialog import android.app.AlertDialog
import android.graphics.Bitmap import android.graphics.Bitmap
import android.net.Uri
import android.net.http.SslError import android.net.http.SslError
import android.util.Log import android.util.Log
import android.webkit.* import android.webkit.*
import com.mime.dualscreenview.common.Blog import com.mime.dualscreenview.common.Blog
import com.mime.dualscreenview.data.HistoryManager import com.mime.dualscreenview.data.HistoryManager
import com.mime.dualscreenview.data.model.LastInfo import com.mime.dualscreenview.data.model.LastInfo
import com.mime.dualscreenview.webcontents.contentsinfo.Booktoki
import com.mime.dualscreenview.webcontents.contentsinfo.DidFindContents import com.mime.dualscreenview.webcontents.contentsinfo.DidFindContents
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@ -83,7 +85,20 @@ open class BaseWebContentsViewer {
// webview.loadUrl(last.pageUrl) // webview.loadUrl(last.pageUrl)
// } // }
// } else { // } else {
if (last.pageUrl.startsWith("http")) {
webview.loadUrl(last.pageUrl) webview.loadUrl(last.pageUrl)
} else {
try {
var uri = Uri.parse(webview.url)
uri.path?.let {
webview.loadUrl(uri.toString().replace(it,last.pageUrl))
}
} catch (e : Exception) {
webview.loadUrl(Booktoki.getLastedDoamin().plus("/").plus(last.pageUrl))
}
}
// } // }
// }) // })
} }