...
This commit is contained in:
parent
0fff1f5aa3
commit
aa6fa8a79e
@ -5,7 +5,6 @@ import android.content.Intent
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Bitmap
|
||||
import android.net.ConnectivityManager
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
@ -16,11 +15,11 @@ import android.text.InputType
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.style.RelativeSizeSpan
|
||||
import android.util.Log
|
||||
import android.view.Gravity
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
import android.view.View.inflate
|
||||
import android.webkit.JavascriptInterface
|
||||
import android.webkit.WebSettings
|
||||
import android.webkit.WebView
|
||||
@ -56,21 +55,15 @@ import com.mime.dualscreenview.view.PagedTextViewInterface
|
||||
import com.mime.dualscreenview.view.TouchArea
|
||||
import com.mime.dualscreenview.webcontents.BaseWebContentsViewer
|
||||
import com.mime.dualscreenview.webcontents.MainControllInterface
|
||||
import com.mime.dualscreenview.webcontents.contentsinfo.Booktoki
|
||||
import com.mime.dualscreenview.webcontents.contentsinfo.GotoSomeWhere
|
||||
import com.mime.dualscreenview.webcontents.contentsinfo.NewtokiOne
|
||||
import com.mime.dualscreenview.webcontents.getT
|
||||
import io.realm.kotlin.UpdatePolicy
|
||||
import io.realm.kotlin.ext.copyFromRealm
|
||||
import io.realm.kotlin.ext.isManaged
|
||||
import io.realm.kotlin.ext.query
|
||||
import io.realm.kotlin.ext.realmListOf
|
||||
import org.jsoup.Jsoup
|
||||
import java.lang.System.currentTimeMillis
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.random.Random
|
||||
|
||||
|
||||
@ -431,8 +424,10 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
super.onPageStarted(view, url, favicon)
|
||||
|
||||
}
|
||||
|
||||
override fun onPageFinished(webView: WebView?, url: String?) {
|
||||
super.onPageFinished(webView, url)
|
||||
// val delayed = 3500L + Math.abs(Random.nextLong().rem(9999L))
|
||||
finishedUrl = url ?: ""
|
||||
webView?.postDelayed({
|
||||
webView?.evaluateJavascript(
|
||||
@ -444,22 +439,29 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
|
||||
}
|
||||
}
|
||||
}, 11000L)
|
||||
}, delayed)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
fun showToast(origin: String) {
|
||||
runOnUiThread {
|
||||
val toast = Toast(this)
|
||||
toast.duration = Toast.LENGTH_SHORT
|
||||
val biggerText = SpannableStringBuilder(origin)
|
||||
biggerText.setSpan(RelativeSizeSpan(1.6f), 0, origin.length, 0)
|
||||
Toast.makeText(
|
||||
baseContext,
|
||||
biggerText,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
val view: View = inflate(this, com.mime.dualscreenview.R.layout.simple_toast,null)
|
||||
view.findViewById<TextView>(com.mime.dualscreenview.R.id.text).text = biggerText
|
||||
toast.setView(view)
|
||||
toast.show()
|
||||
// Toast.makeText(
|
||||
// baseContext,
|
||||
// biggerText,
|
||||
// Toast.LENGTH_SHORT
|
||||
// ).show()
|
||||
}
|
||||
}
|
||||
var delayed = 3500L + Math.abs(Random.nextLong().rem(9999L))
|
||||
var finishedUrl : String? = null
|
||||
inner class SaveHelper {
|
||||
@JavascriptInterface
|
||||
@ -472,9 +474,10 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
// Blog.LOGE("finishedUrl >>> ${finishedUrl} :::: view_padding.get(0)\n${contents}")
|
||||
if (contents.length > 20) {
|
||||
Uri.parse(finishedUrl).path?.let {
|
||||
delayed = 3500L + Math.abs(Random.nextLong().rem(9999L))
|
||||
HistoryManager.getBooPageInfoContentsSave(it, contents).apply {
|
||||
HistoryManager.getBookPageInfo(it) { book ->
|
||||
showToast("saved ${book?.getTitleItem()} :: lenght = ${contents.length}")
|
||||
showToast("saved ${book?.getTitleItem()} \n:: lenght = ${contents.length} \n:: saveTarget = ${saveTarget.size}\n:: delayed >> ${delayed}")
|
||||
}
|
||||
}.apply {
|
||||
HistoryManager.getBookInfos(it) { saveItem(it)}
|
||||
|
||||
@ -286,9 +286,7 @@ class PagedTextLayout : ConstraintLayout , PagedTextGenerateInterface {
|
||||
}
|
||||
|
||||
fun forceUpdateUI() {
|
||||
// mPagedTextViewInterface?.onTouch(TouchArea.Center)
|
||||
hiddenTextView?.doUpdate()
|
||||
// hanler?.postDelayed(touchTimeover, 3000L)
|
||||
}
|
||||
|
||||
override fun setPadding(left: Int, top: Int, right: Int, bottom: Int) {
|
||||
|
||||
6
app/src/main/res/drawable/simple_bg.xml
Normal file
6
app/src/main/res/drawable/simple_bg.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<corners android:radius="10dp"/>
|
||||
<solid android:color="#44ffffff"/>
|
||||
<stroke android:color="@color/white" android:width="1dp"/>
|
||||
</shape>
|
||||
14
app/src/main/res/layout/simple_toast.xml
Normal file
14
app/src/main/res/layout/simple_toast.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@drawable/simple_bg"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:layout_gravity="center"
|
||||
android:gravity="left"
|
||||
android:id="@+id/text"
|
||||
android:textColor="@color/black"
|
||||
android:background="@null"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</FrameLayout>
|
||||
Loading…
x
Reference in New Issue
Block a user