...
This commit is contained in:
parent
fc5f17018a
commit
a2d90b16bf
@ -418,11 +418,12 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
|||||||
return text.trim()
|
return text.trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isLoading = false
|
||||||
var saveClient = object : WebViewClient() {
|
var saveClient = object : WebViewClient() {
|
||||||
|
|
||||||
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
|
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
|
||||||
super.onPageStarted(view, url, favicon)
|
super.onPageStarted(view, url, favicon)
|
||||||
|
isLoading = true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPageFinished(webView: WebView?, url: String?) {
|
override fun onPageFinished(webView: WebView?, url: String?) {
|
||||||
@ -438,6 +439,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
|||||||
(result as? String)?.let {
|
(result as? String)?.let {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
isLoading = false
|
||||||
}
|
}
|
||||||
}, delayed)
|
}, delayed)
|
||||||
}
|
}
|
||||||
@ -515,18 +517,19 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Blog.LOGE("saveItem >>> saveTarget ${saveTarget.count()}")
|
Blog.LOGE("saveItem >>> saveTarget ${saveTarget.count()}")
|
||||||
try {
|
try {
|
||||||
saveTarget.removeFirst().let {
|
if (isLoading == false) {
|
||||||
Blog.LOGE("saveItem >>> ${it.pathUrl}")
|
saveTarget.removeFirst().let {
|
||||||
runOnUiThread {
|
Blog.LOGE("saveItem >>> ${it.pathUrl}")
|
||||||
mBaseWebContentsViewer.webview.url?.let { currentUrl ->
|
runOnUiThread {
|
||||||
currentUrl.replace(Uri.parse(currentUrl).path ?: "", it.pathUrl ?: "")
|
mBaseWebContentsViewer.webview.url?.let { currentUrl ->
|
||||||
?.let { targetUrl ->
|
currentUrl.replace(Uri.parse(currentUrl).path ?: "", it.pathUrl ?: "")
|
||||||
Blog.LOGE("targetUrl >>> ${targetUrl}")
|
?.let { targetUrl ->
|
||||||
contentsSaver?.loadUrl(targetUrl)
|
Blog.LOGE("targetUrl >>> ${targetUrl}")
|
||||||
}
|
contentsSaver?.loadUrl(targetUrl)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,20 +105,20 @@ open class BaseWebContentsViewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val rootWebViewClient = object : WebViewClient() {
|
val rootWebViewClient = object : WebViewClient() {
|
||||||
override fun shouldInterceptRequest(
|
// override fun shouldInterceptRequest(
|
||||||
view: WebView?,
|
// view: WebView?,
|
||||||
request: WebResourceRequest?
|
// request: WebResourceRequest?
|
||||||
): WebResourceResponse? {
|
// ): WebResourceResponse? {
|
||||||
Log.e("shouldInterceptRequest", " >>>> ${request?.url?.toString()} , ${request?.url?.toString()?.contains("gif")}")
|
// Log.e("shouldInterceptRequest", " >>>> ${request?.url?.toString()} , ${request?.url?.toString()?.contains("gif")}")
|
||||||
|
//
|
||||||
if(request?.url?.toString()?.contains("gif") ?: false) {
|
// if(request?.url?.toString()?.contains("gif") ?: false) {
|
||||||
return WebResourceResponse("text/javascript", "UTF-8", null);
|
|
||||||
}
|
|
||||||
// if(request?.url?.toString()?.contains(currentContentsProvider?.acccceptResourceKeyword() ?: "") == false && request?.url?.toString()?.contains(currentContentsProvider?.getLastedDoamin() ?: "") == false) {
|
|
||||||
// return WebResourceResponse("text/javascript", "UTF-8", null);
|
// return WebResourceResponse("text/javascript", "UTF-8", null);
|
||||||
// }
|
// }
|
||||||
return super.shouldInterceptRequest(view, request)
|
//// if(request?.url?.toString()?.contains(currentContentsProvider?.acccceptResourceKeyword() ?: "") == false && request?.url?.toString()?.contains(currentContentsProvider?.getLastedDoamin() ?: "") == false) {
|
||||||
}
|
//// return WebResourceResponse("text/javascript", "UTF-8", null);
|
||||||
|
//// }
|
||||||
|
// return super.shouldInterceptRequest(view, request)
|
||||||
|
// }
|
||||||
|
|
||||||
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
|
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
|
||||||
super.onPageStarted(view, url, favicon)
|
super.onPageStarted(view, url, favicon)
|
||||||
@ -194,24 +194,24 @@ open class BaseWebContentsViewer {
|
|||||||
|
|
||||||
Jsoup.parse(string)?.let { html ->
|
Jsoup.parse(string)?.let { html ->
|
||||||
|
|
||||||
val toon_intro = html.getElementById("toon_intro")
|
val toon_intro = html.getElementsByClass("toon_index")?.first()
|
||||||
val view_padding = html.getElementsByClass("view-padding")
|
val view_padding = html.select("#bo_v_con")
|
||||||
if (toon_intro != null) {
|
if (toon_intro != null) {
|
||||||
// Blog.LOGE("finishedUrl >>> ${finishedUrl} :::: ${html.title()}")
|
Blog.LOGE("finishedUrl >>> ${finishedUrl} :::: ${html.title()}")
|
||||||
val bookPageInfos = BookPageInfos()
|
val bookPageInfos = BookPageInfos()
|
||||||
bookPageInfos.bookPageUrl = Uri.parse(finishedUrl).path
|
bookPageInfos.bookPageUrl = Uri.parse(finishedUrl).path
|
||||||
bookPageInfos.bookTitle = if (toon_intro.getElementsByTag("h3").size > 0) toon_intro.getElementsByTag("h3").get(0).text() else ""
|
bookPageInfos.bookTitle = if (toon_intro.getElementsByTag("h3").size > 0) toon_intro.getElementsByTag("h3").get(0).text() else ""
|
||||||
bookPageInfos.pages = realmListOf<BookPageInfo>()
|
bookPageInfos.pages = realmListOf<BookPageInfo>()
|
||||||
// Blog.LOGE("finishedUrl >>> ${finishedUrl} :::: bookPageInfos >>>> ${Gson().toJson(bookPageInfos)}")
|
Blog.LOGE("finishedUrl >>> ${finishedUrl} :::: bookPageInfos >>>> ${Gson().toJson(bookPageInfos)}")
|
||||||
val listParent = html.getElementById("list_type")
|
val listParent = toon_intro.getElementsByTag("ul").first()
|
||||||
if (listParent != null) {
|
if (listParent != null) {
|
||||||
listParent.getElementsByClass("row").forEach { bookitem ->
|
listParent.getElementsByTag("li").reversed().forEachIndexed { idx, bookitem ->
|
||||||
// Blog.LOGE("finishedUrl >>> ${finishedUrl} :::: bookItemInfo ${bookitem}")
|
Blog.LOGE("finishedUrl >>> ${finishedUrl} :::: bookItemInfo ${bookitem.html()}")
|
||||||
try {
|
try {
|
||||||
val bookPageInfo = BookPageInfo()
|
val bookPageInfo = BookPageInfo()
|
||||||
bookPageInfo.bookTitle = bookPageInfos.bookTitle
|
bookPageInfo.bookTitle = bookPageInfos.bookTitle
|
||||||
bookPageInfo.chapterNum = bookitem.getElementsByClass("cell_num").getT().toInt()
|
bookPageInfo.chapterNum = idx + 1
|
||||||
bookPageInfo.chapterID = bookitem.getElementsByClass("cell_num").getT().toInt()
|
bookPageInfo.chapterID = idx + 1
|
||||||
bookPageInfo.chapterTitle = bookitem.getElementsByTag("a").getT()
|
bookPageInfo.chapterTitle = bookitem.getElementsByTag("a").getT()
|
||||||
bookPageInfo.bookPageUrl = bookPageInfos.bookPageUrl
|
bookPageInfo.bookPageUrl = bookPageInfos.bookPageUrl
|
||||||
val href = bookitem.getElementsByTag("a").get(0).attr("href")
|
val href = bookitem.getElementsByTag("a").get(0).attr("href")
|
||||||
@ -231,17 +231,22 @@ open class BaseWebContentsViewer {
|
|||||||
}
|
}
|
||||||
}else if (view_padding.size > 0){
|
}else if (view_padding.size > 0){
|
||||||
// Blog.LOGE("finishedUrl >>> ${finishedUrl} :::: ${html.title()}")
|
// Blog.LOGE("finishedUrl >>> ${finishedUrl} :::: ${html.title()}")
|
||||||
val contents = view_padding.get(0).children().html().replace("<p>"," ").replace("</p>","\n\n")
|
val contents = StringBuffer()
|
||||||
// Blog.LOGE("finishedUrl >>> ${finishedUrl} :::: view_padding.get(0)\n${contents}")
|
view_padding.get(0).getElementsByTag("P").forEach {
|
||||||
|
it.text().apply {
|
||||||
|
contents.append(this).append("\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
if (contents.length > 20) {
|
if (contents.length > 20) {
|
||||||
Uri.parse(finishedUrl).path?.let {
|
Uri.parse(finishedUrl).path?.let {
|
||||||
HistoryManager.getBooPageInfoContentsSave(it, contents)
|
HistoryManager.getBooPageInfoContentsSave(it, contents.toString())
|
||||||
mainControllInterface.onLoadedContents(contents)
|
mainControllInterface.onLoadedContents(contents.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Blog.LOGE("finishedUrl >>> ${finishedUrl} :::: ${html.title()}")
|
Blog.LOGE("finishedUrl >>> ${finishedUrl} :::: ${html.title()}")
|
||||||
Blog.LOGE("finishedUrl >>> ${finishedUrl} :::: whole body ${html}")
|
// Blog.LOGE("finishedUrl >>> ${finishedUrl} :::: whole body ${html}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ object NewtokiOne : BaseWebContents() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getLastedDoamin(): String {
|
override fun getLastedDoamin(): String {
|
||||||
return "https://newtoki.one"
|
return "https://newtoki.biz"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getContentsList(): String {
|
override fun getContentsList(): String {
|
||||||
|
|||||||
BIN
app/src/main/res/font/gtrd_regular.ttf
Normal file
BIN
app/src/main/res/font/gtrd_regular.ttf
Normal file
Binary file not shown.
BIN
app/src/main/res/font/pretendard_light.otf
Normal file
BIN
app/src/main/res/font/pretendard_light.otf
Normal file
Binary file not shown.
BIN
app/src/main/res/font/pretendard_thin.otf
Normal file
BIN
app/src/main/res/font/pretendard_thin.otf
Normal file
Binary file not shown.
BIN
app/src/main/res/font/soyo_maple_regular.ttf
Normal file
BIN
app/src/main/res/font/soyo_maple_regular.ttf
Normal file
Binary file not shown.
BIN
app/src/main/res/font/wantedsansstd_regular.ttf
Normal file
BIN
app/src/main/res/font/wantedsansstd_regular.ttf
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user