Merge branch 'main' of https://bitbucket.org/gbumhan/tokkiz
# Conflicts: # app/src/main/java/com/mime/dualscreenview/webcontents/BaseWebContentsViewer.kt .
This commit is contained in:
commit
f5003d9378
@ -6,6 +6,7 @@
|
||||
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
android:name=".BaseAppication"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
package com.mime.dualscreenview
|
||||
|
||||
import android.app.Application
|
||||
import com.mime.dualscreenview.common.PrefManager
|
||||
import io.realm.kotlin.Realm
|
||||
|
||||
class BaseAppication : Application() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
PrefManager.init(this)
|
||||
}
|
||||
}
|
||||
@ -1,16 +1,16 @@
|
||||
package com.mime.dualscreenview.activity
|
||||
|
||||
import android.content.ComponentName
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.content.pm.PackageManager.NameNotFoundException
|
||||
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
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import android.text.InputType
|
||||
import android.text.SpannableStringBuilder
|
||||
@ -26,17 +26,18 @@ import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.EditText
|
||||
import android.widget.ImageButton
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.constraintlayout.utils.widget.ImageFilterButton
|
||||
import androidx.core.net.toUri
|
||||
import com.google.gson.Gson
|
||||
import com.mime.dualscreenview.R
|
||||
import com.mime.dualscreenview.common.Blog
|
||||
import com.mime.dualscreenview.common.PairArray
|
||||
import com.mime.dualscreenview.common.PrefManager
|
||||
import com.mime.dualscreenview.common.colorz
|
||||
import com.mime.dualscreenview.common.getIndex
|
||||
import com.mime.dualscreenview.common.typesfacez
|
||||
@ -47,6 +48,7 @@ import com.mime.dualscreenview.data.model.BookPageInfosJ
|
||||
import com.mime.dualscreenview.data.model.HistoryItem
|
||||
import com.mime.dualscreenview.data.model.LastInfo
|
||||
import com.mime.dualscreenview.data.model.ReaderConfig
|
||||
import com.mime.dualscreenview.databinding.IntroBinding
|
||||
import com.mime.dualscreenview.dialog.DefaultList
|
||||
import com.mime.dualscreenview.view.PagedTextLayout
|
||||
import com.mime.dualscreenview.view.PagedTextViewInterface
|
||||
@ -58,40 +60,37 @@ import com.mime.dualscreenview.webcontents.contentsinfo.GotoSomeWhere
|
||||
import io.realm.kotlin.UpdatePolicy
|
||||
import io.realm.kotlin.ext.copyFromRealm
|
||||
import io.realm.kotlin.ext.query
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.MainScope
|
||||
import kotlinx.coroutines.launch
|
||||
import java.lang.System.currentTimeMillis
|
||||
import java.text.Normalizer
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.regex.Pattern
|
||||
import kotlin.random.Random
|
||||
|
||||
|
||||
class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
|
||||
|
||||
|
||||
// Save previous state of dual screens
|
||||
|
||||
|
||||
private lateinit var mBaseWebContentsViewer : BaseWebContentsViewer
|
||||
var lastInfo : LastInfo? = null
|
||||
lateinit var paged_layer : PagedTextLayout
|
||||
lateinit var textview_title : TextView
|
||||
var currentBooinfo : BookPageInfo? = null
|
||||
val handle = object : Handler() {
|
||||
|
||||
val handle = object : Handler(Looper.getMainLooper()) {
|
||||
override fun handleMessage(msg: Message) {
|
||||
// super.handleMessage(msg)
|
||||
if (msg.what == 0 ) {
|
||||
(msg.obj as? ReaderConfig)?.let {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun getCurrentUrl() : String {
|
||||
var currentPath = currentBooinfo?.pathUrl ?: mBaseWebContentsViewer.webview.url?.toUri()?.path ?: ""
|
||||
var domain = PrefManager.getLastDomain()
|
||||
return domain.plus("/").plus(if (currentPath.length > 4) currentPath else "")
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
Blog.LOGD(log= "onConfigurationChanged ${this::class.java.name} >> newConfig ${newConfig}")
|
||||
@ -99,11 +98,13 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
}
|
||||
|
||||
var contentsSaver : WebView? = null
|
||||
lateinit var binding : IntroBinding
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
Blog.LOGD(log= "onCreate ${this::class.java.name} >> savedInstanceState ${savedInstanceState}")
|
||||
setContentView(R.layout.intro)
|
||||
findViewById<WebView>(R.id.menu_web)?.let {
|
||||
binding = IntroBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
binding.menuWeb.let {
|
||||
it.setOnLongClickListener {
|
||||
onTouch(TouchArea.Center)
|
||||
return@setOnLongClickListener false
|
||||
@ -111,19 +112,22 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
mBaseWebContentsViewer = BaseWebContentsViewer(it,this)
|
||||
}
|
||||
|
||||
paged_layer = findViewById<PagedTextLayout>(R.id.paged_layer)
|
||||
textview_title = findViewById<TextView>(R.id.textview_title)
|
||||
paged_layer = binding.pagedLayer
|
||||
textview_title = binding.textviewTitle
|
||||
|
||||
findViewById<ImageButton>(R.id.btn_list).setOnClickListener { v ->
|
||||
binding.btnList.setOnClickListener { v ->
|
||||
mBaseWebContentsViewer?.webview?.url?.let {
|
||||
Uri.parse(it).path?.let {
|
||||
HistoryManager.getBooInfo(it, {
|
||||
it?.let { showList(it) }
|
||||
HistoryManager.getBookInfos(it, {
|
||||
it?.let {
|
||||
it.pages.sortBy { it.pathUrl }
|
||||
showList(it)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
findViewById<WebView>(R.id.hidden_web)?.let { v->
|
||||
binding.hiddenWeb?.let { v->
|
||||
contentsSaver = v
|
||||
contentsSaver?.webViewClient = saveClient
|
||||
contentsSaver?.settings?.textZoom = 100
|
||||
@ -141,46 +145,19 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
// switcvhOrient()
|
||||
// }
|
||||
|
||||
findViewById<View>(R.id.btn_setting).setOnClickListener { v->
|
||||
// var intent = Intent()
|
||||
// var findIntent = Intent(Intent.ACTION_MAIN,null)
|
||||
// var list = packageManager.queryIntentActivities(findIntent,0)
|
||||
// list.forEach {
|
||||
// Blog.LOGE("activityInfo ============START================")
|
||||
// val pm = applicationContext.packageManager
|
||||
// var ai = try {
|
||||
// pm.getApplicationInfo(it.activityInfo.packageName, 0)
|
||||
// } catch (e: NameNotFoundException) {
|
||||
// null
|
||||
// }
|
||||
// val applicationName =
|
||||
// (if (ai != null) pm.getApplicationLabel(ai) else "(unknown)") as String
|
||||
// Blog.LOGE("applicationName ============:: ${applicationName} ::================")
|
||||
// Blog.LOGE("it.activityInfo.processName ::=> ${it.activityInfo.processName}")
|
||||
// Blog.LOGE("it.activityInfo.targetActivity ::=> ${it.activityInfo.targetActivity}")
|
||||
// Blog.LOGE("it.activityInfo.name ::=> ${it.activityInfo.name}")
|
||||
// Blog.LOGE("it.activityInfo.packageName ::=> ${it.activityInfo.packageName}")
|
||||
// Blog.LOGE("it.resolvePackageName ::=> ${it.resolvePackageName}")
|
||||
// Blog.LOGE("activityInfo ============END================")
|
||||
// }
|
||||
//
|
||||
//
|
||||
// var startIntene = Intent(Intent.ACTION_MAIN)
|
||||
// startIntene.setComponent(ComponentName("com.samsung.android.app.interpreter","com.samsung.android.app.interpreter.interpretation.view.InterpretationActivity"))
|
||||
// startActivity(startIntene)
|
||||
binding.btnSetting.setOnClickListener { v->
|
||||
startActivity(Intent(this@Intro, Settings::class.java))
|
||||
}
|
||||
findViewById<View>(R.id.btn_history).setOnClickListener { v->
|
||||
binding.btnHistory.setOnClickListener { v->
|
||||
var realm = openRealm()
|
||||
realm.query<HistoryItem>()?.find()?.let {
|
||||
realm.query<HistoryItem>().find().let {
|
||||
showHistory(realm.copyFromRealm(it))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
findViewById<View>(R.id.btn_home).setOnClickListener { v->
|
||||
paged_layer?.visibility = GONE
|
||||
binding.btnHome.setOnClickListener { v->
|
||||
paged_layer.visibility = GONE
|
||||
mBaseWebContentsViewer.loadContents(Booktoki)
|
||||
}
|
||||
|
||||
@ -189,10 +166,10 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
|
||||
fun loadLastInfo(){
|
||||
val realm = openRealm()
|
||||
try { lastInfo = realm?.query<LastInfo>()?.find()?.last()?.copyFromRealm()
|
||||
try { lastInfo = realm.query<LastInfo>().find().last()?.copyFromRealm()
|
||||
try {
|
||||
if (lastInfo != null) {
|
||||
HistoryManager.getBooPageInfo(Uri.parse(lastInfo!!.pageUrl!!).path!!) {
|
||||
HistoryManager.getBookPageInfo(Uri.parse(lastInfo!!.pageUrl!!).path!!) {
|
||||
it?.let {
|
||||
currentBooinfo = it
|
||||
paged_layer.text = it!!.contents!!
|
||||
@ -208,7 +185,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
mBaseWebContentsViewer.webview.loadUrl(Booktoki.getLastedDoamin() + it?.pathUrl!!)
|
||||
}
|
||||
it?.pathUrl?.let {
|
||||
HistoryManager.getBooInfo(it) {
|
||||
HistoryManager.getBookInfos(it) {
|
||||
saveItem(it)
|
||||
}
|
||||
}
|
||||
@ -245,6 +222,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
}} catch (e : Exception) { }
|
||||
|
||||
}
|
||||
|
||||
fun reloadLastInfo() {
|
||||
val configuration: Configuration = getResources().getConfiguration()
|
||||
if(lastInfo != null && lastInfo?.displayOrientation != configuration.orientation) {
|
||||
@ -258,15 +236,9 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
var infos : BookPageInfos? = null
|
||||
realm.writeBlocking {
|
||||
try {
|
||||
|
||||
var infosj : BookPageInfosJ? = null
|
||||
|
||||
infosj = Gson().fromJson(jsonString, BookPageInfosJ::class.java)
|
||||
Blog.LOGE("onBookInfos" , "onBookInfos 2 >> ${infosj}")
|
||||
Blog.LOGE("onBookInfos" , "onBookInfos 2 - 1 >> ${infosj?.pages}")
|
||||
// realm.createObjectFromJson
|
||||
Blog.LOGE("onBookInfos" , "onBookInfos 2 - 1 >> ${infosj?.getR()}")
|
||||
HistoryManager.getBooInfo(infosj.bookPageUrl!!){
|
||||
HistoryManager.getBookInfos(infosj.bookPageUrl!!){
|
||||
if (it != null) {
|
||||
|
||||
infos = copyToRealm(it!!, UpdatePolicy.ALL)
|
||||
@ -275,8 +247,9 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
infos!!.pages.add(item.getRealm())
|
||||
}
|
||||
}
|
||||
Blog.LOGE("onBookInfos", "onBookInfos 3 >> ${realm.query<BookPageInfos>().find().size}")
|
||||
Blog.LOGE("onBookInfos", "onBookInfos 4 >> ${realm.query<BookPageInfo>().find().size}")
|
||||
if (infos != null) {
|
||||
infos = this.copyFromRealm(infos!!)
|
||||
}
|
||||
} else {
|
||||
infos = infosj?.getR()
|
||||
if (infos != null) {
|
||||
@ -284,25 +257,24 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
for (item in infosj.pages) {
|
||||
infos?.pages?.add(item.getRealm())
|
||||
}
|
||||
Blog.LOGE("onBookInfos", "onBookInfos 3 >> ${realm.query<BookPageInfos>().find().size}")
|
||||
Blog.LOGE("onBookInfos", "onBookInfos 4 >> ${realm.query<BookPageInfo>().find().size}")
|
||||
}
|
||||
if (infos != null) {
|
||||
infos = this.copyFromRealm(infos!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (infos != null) {
|
||||
infos = this.copyFromRealm(infos!!)
|
||||
}
|
||||
|
||||
} catch (e :Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
infos?.bookPageUrl?.let {
|
||||
HistoryManager.getBooInfo(it){
|
||||
it?.let {
|
||||
Blog.LOGE("onBookInfos" , "onBookInfos it >> ${it}")
|
||||
runOnUiThread {
|
||||
showList(it)
|
||||
} finally {
|
||||
infos?.bookPageUrl?.let {
|
||||
HistoryManager.getBookInfos(it){
|
||||
it?.let {
|
||||
Blog.LOGE("onBookInfos" , "onBookInfos it >> ${it}")
|
||||
runOnUiThread {
|
||||
showList(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -376,7 +348,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
builderInner.setPositiveButton("Ok",
|
||||
DialogInterface.OnClickListener {
|
||||
dialog, which ->
|
||||
reloadTo(item.makeLastInfo())
|
||||
contentsLoad(item.pageUrl)
|
||||
dialog.dismiss()
|
||||
})
|
||||
builderInner.setNeutralButton("삭제",
|
||||
@ -414,7 +386,9 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
for (item in infos.pages) {
|
||||
items.add(item)
|
||||
}
|
||||
items.sortBy { it.chapterNum }
|
||||
|
||||
items.sortBy { it.chapterID }
|
||||
|
||||
DefaultList.showDefaultList(
|
||||
this@Intro,
|
||||
"현제는 ${currentTitle} - ${(infos.pages.size ?: 0) - currentChapter} -> 다른화를 골라",
|
||||
@ -456,62 +430,88 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
override fun onPageFinished(webView: WebView?, url: String?) {
|
||||
super.onPageFinished(webView, url)
|
||||
isLoading = false
|
||||
var ramdomTimeSec = 1000L + Random(System.currentTimeMillis()).nextLong().rem(3999)
|
||||
Blog.LOGE("ramdomTime >>> ${ramdomTimeSec}")
|
||||
webView?.postDelayed( {
|
||||
Blog.LOGE("saveClient >>> ${isLoading} ${url}")
|
||||
var findContents = Booktoki.getFindContentsJs()
|
||||
webView?.evaluateJavascript(findContents){ result: String? ->
|
||||
result?.let { string: String ->
|
||||
Blog.LOGE("saveClient contents >>> ${string.length}")
|
||||
if (string.length > 10) {
|
||||
Blog.LOGE("saveClient it.length >>> ${string.length}")
|
||||
var contents = string.replace("\\\"","\"")
|
||||
contents = (contents.replace("\\n", System.getProperty("line.separator")))
|
||||
contents = (contents.replace("\\n", System.getProperty("line.separator")))
|
||||
webView?.postDelayed({ autoScrollDown(webView, url) },(1300L + Random(System.currentTimeMillis()).nextLong().rem(1286L)))
|
||||
}
|
||||
fun showToast(origin: String) {
|
||||
runOnUiThread {
|
||||
val biggerText = SpannableStringBuilder(origin)
|
||||
biggerText.setSpan(RelativeSizeSpan(1.6f), 0, origin.length, 0)
|
||||
Toast.makeText(
|
||||
baseContext,
|
||||
biggerText,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
|
||||
Blog.LOGE("saveClient contents >>> ${contents.length}")
|
||||
Uri.parse(url)?.let {
|
||||
it.path?.let {
|
||||
HistoryManager.getBooPageInfoContentsSave(it, contents.replace(Char(0x20).toString()," "))
|
||||
HistoryManager.getBooPageInfo(it) { info ->
|
||||
runOnUiThread {
|
||||
info?.let {
|
||||
var origin = info.getTitleItem()
|
||||
val biggerText = SpannableStringBuilder(origin)
|
||||
biggerText.setSpan(RelativeSizeSpan(1.6f), 0, origin.length, 0)
|
||||
Toast.makeText(baseContext,biggerText, Toast.LENGTH_SHORT).apply {
|
||||
setGravity(Gravity.CENTER, 0, 0)
|
||||
}.show()
|
||||
fun autoScrollDown(webView: WebView?, url: String?) {
|
||||
webView?.let { webView ->
|
||||
val ramdomTimeSec =
|
||||
800L.plus(Random(System.currentTimeMillis()).nextLong().rem(789L))
|
||||
Blog.LOGE("ramdomTime >>> ${ramdomTimeSec}")
|
||||
if (((webView?.scrollY ?: 0) + (webView?.height
|
||||
?: 0)) < webView?.contentHeight ?: 0
|
||||
) {
|
||||
webView?.postDelayed({
|
||||
webView?.pageDown(false)
|
||||
autoScrollDown(webView, url)
|
||||
}, ramdomTimeSec)
|
||||
} else {
|
||||
webView?.postDelayed({
|
||||
var findContents = Booktoki.getFindContentsJs()
|
||||
webView?.evaluateJavascript(findContents) { result: String? ->
|
||||
result?.let { string: String ->
|
||||
if (string.length > 10) {
|
||||
val contents = string.replace("\\\"", "\"")
|
||||
.replace("\\n", System.getProperty("line.separator"))
|
||||
.replace("\\n", System.getProperty("line.separator"))
|
||||
Uri.parse(url)?.let {
|
||||
it.path?.let {
|
||||
HistoryManager.getBooPageInfoContentsSave(it, contents.replace(Char(0x20).toString(), " "))
|
||||
HistoryManager.getBookPageInfo(it) { info ->
|
||||
info?.let { showToast(info.getTitleItem()) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var ramdomTime = 2000L.plus(Random(System.currentTimeMillis()).nextLong().rem(1785L))
|
||||
Blog.LOGE("afterNextPageTime >>> ${ramdomTime}")
|
||||
contentsSaver?.postDelayed({ saveItem(null) }, ramdomTime)
|
||||
}
|
||||
}
|
||||
var ramdomTime = 8000L + Random(System.currentTimeMillis()).nextLong().rem(7999)
|
||||
Blog.LOGE("ramdomTime >>> ${ramdomTime}")
|
||||
contentsSaver?.postDelayed( { saveItem(null) }, ramdomTime)
|
||||
}
|
||||
}},ramdomTimeSec)
|
||||
}, ramdomTimeSec)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var saveTarget : ArrayList<BookPageInfo> = arrayListOf()
|
||||
private fun saveItem(infos: BookPageInfos?) {
|
||||
Blog.LOGE("saveItem >>> infos?.pages ${infos?.pages?.size ?: 0}")
|
||||
var savedCount = Math.abs(Random(System.currentTimeMillis()).nextLong().rem(19) + 6L)
|
||||
var savedCount = Math.abs(Random(System.currentTimeMillis()).nextLong().rem(9) + 6L)
|
||||
Blog.LOGE("saveItem >>> targetCount = ${savedCount}")
|
||||
|
||||
infos?.pages?.reversed()?.forEach {
|
||||
if ((it.contents?.length ?: 0) > 10) {
|
||||
} else {
|
||||
if (saveTarget.size < savedCount.toInt()) {
|
||||
if (savedCount.toInt() > 0) {
|
||||
saveTarget.add(it)
|
||||
savedCount = savedCount - 1L
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (savedCount > 0) {
|
||||
HistoryManager.openRealm.query<BookPageInfo>().find().forEach {
|
||||
if ((it.contents?.length ?: 0) > 10) {
|
||||
} else if(savedCount.toInt() > 0) {
|
||||
saveTarget.add(HistoryManager.openRealm.copyFromRealm(it))
|
||||
savedCount = savedCount - 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Blog.LOGE("saveItem >>> saveTarget ${saveTarget.count()}")
|
||||
if (isLoading == false) {
|
||||
try {
|
||||
@ -578,117 +578,65 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun moveToNext(pathUrl : String?) {
|
||||
if (pathUrl != null && pathUrl.length > 6) {
|
||||
HistoryManager.getNextPage(pathUrl!!) {
|
||||
if(it != null && it!!.pathUrl?.length ?: 0 > 6) {contentsLoad(it.pathUrl!!)}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun moveToPrev(pathUrl : String?) {
|
||||
if (pathUrl != null && pathUrl.length > 6) {
|
||||
HistoryManager.getPrevPage(pathUrl!!) {
|
||||
if(it != null && it!!.pathUrl?.length ?: 0 > 6) {contentsLoad(it.pathUrl!!)}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun contentsLoad(pathUrl : String) {
|
||||
HistoryManager.getBookPageInfo(pathUrl) {
|
||||
it?.pathUrl?.let {
|
||||
HistoryManager.getBookInfos(it) { saveItem(it) }
|
||||
}
|
||||
if (it != null) currentBooinfo = it
|
||||
if (it != null && (it?.contents?.length ?: 0) > 10) {
|
||||
paged_layer.visibility = VISIBLE
|
||||
paged_layer.text = it!!.contents!!
|
||||
if((it?.pathUrl?.length ?: 0) > 0) {
|
||||
if (lastInfo?.pageUrl?.length ?: 0 > 0 && lastInfo?.pageUrl!!.startsWith("http")) {
|
||||
mBaseWebContentsViewer.webview.loadUrl(lastInfo!!.pageUrl!!.replace(Uri.parse(lastInfo!!.pageUrl)!!.path!!,it?.pathUrl!!))
|
||||
} else {
|
||||
mBaseWebContentsViewer.webview.loadUrl(Booktoki.getLastedDoamin() + it?.pathUrl!!)
|
||||
}
|
||||
HistoryManager.save(historyItem = HistoryItem().putHistory(it,mBaseWebContentsViewer.webview.url!!))
|
||||
}
|
||||
applyReaderConfig()
|
||||
} else {
|
||||
if(it?.pathUrl?.length ?: 0 > 0) {
|
||||
if (lastInfo?.pageUrl?.length ?: 0 > 0 && lastInfo?.pageUrl!!.startsWith("http")) {
|
||||
paged_layer.visibility = GONE
|
||||
mBaseWebContentsViewer.webview.loadUrl(lastInfo!!.pageUrl!!.replace(Uri.parse(lastInfo!!.pageUrl)!!.path!!,it?.pathUrl!!))
|
||||
} else {
|
||||
paged_layer.visibility = GONE
|
||||
mBaseWebContentsViewer.webview.loadUrl(Booktoki.getLastedDoamin() + it?.pathUrl!!)
|
||||
}
|
||||
HistoryManager.save(historyItem = HistoryItem().putHistory(it,mBaseWebContentsViewer.webview.url!!))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
fun actionNextEvent(fast : Boolean = false) {
|
||||
if (paged_layer != null && paged_layer!!.visibility == View.VISIBLE && paged_layer!!.size() > 0 && (paged_layer!!.current() < paged_layer!!.size() - 1) ) {
|
||||
paged_layer!!.doNext(fast)
|
||||
updateLastInfo(paged_layer!!)
|
||||
} else {
|
||||
val pathUrl = currentBooinfo?.pathUrl
|
||||
if (pathUrl != null && pathUrl.length > 6) {
|
||||
HistoryManager.getNextPage(pathUrl) {
|
||||
currentBooinfo = it
|
||||
paged_layer.text = it!!.contents!!
|
||||
Blog.LOGE("HistoryManager.getNextPage(${it})")
|
||||
if ((it?.contents?.length ?: 0) > 10) {
|
||||
paged_layer.visibility = VISIBLE
|
||||
if((it?.pathUrl?.length ?: 0) > 0) {
|
||||
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!!)
|
||||
}
|
||||
HistoryManager.save(historyItem = HistoryItem().putHistory(it,mBaseWebContentsViewer.webview.url!!))
|
||||
}
|
||||
applyReaderConfig()
|
||||
} else {
|
||||
if(it?.pathUrl?.length ?: 0 > 0) {
|
||||
Blog.LOGE("HistoryManager.getNextPage(${it?.pathUrl})")
|
||||
if (lastInfo?.pageUrl?.length ?: 0 > 0 && lastInfo?.pageUrl!!.startsWith("http")) {
|
||||
Blog.LOGE("HistoryManager.getNextPage(${lastInfo?.pageUrl})")
|
||||
paged_layer.visibility = GONE
|
||||
mBaseWebContentsViewer.webview.loadUrl(lastInfo!!.pageUrl!!.replace(Uri.parse(lastInfo!!.pageUrl)!!.path!!,it?.pathUrl!!))
|
||||
} else {
|
||||
Blog.LOGE("HistoryManager.getNextPage(${Booktoki.getLastedDoamin()})")
|
||||
paged_layer.visibility = GONE
|
||||
mBaseWebContentsViewer.webview.loadUrl(Booktoki.getLastedDoamin() + it?.pathUrl!!)
|
||||
}
|
||||
HistoryManager.save(historyItem = HistoryItem().putHistory(it,mBaseWebContentsViewer.webview.url!!))
|
||||
}
|
||||
}
|
||||
it?.pathUrl?.let {
|
||||
HistoryManager.getBooInfo(it) {
|
||||
saveItem(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Uri.parse(mBaseWebContentsViewer.webview.url)?.let {
|
||||
it.path?.let {
|
||||
HistoryManager.getNextPage(it) {
|
||||
Blog.LOGE("HistoryManager.getNextPage(${it})")
|
||||
if (it?.contents?.length ?: 0 > 10) {
|
||||
currentBooinfo = it
|
||||
paged_layer.text = it!!.contents!!
|
||||
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) {
|
||||
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!!
|
||||
)
|
||||
)
|
||||
paged_layer?.visibility = GONE
|
||||
} else {
|
||||
Blog.LOGE("HistoryManager.getNextPage(${Booktoki.getLastedDoamin()})")
|
||||
mBaseWebContentsViewer.webview.loadUrl(Booktoki.getLastedDoamin() + it?.pathUrl!!)
|
||||
paged_layer?.visibility = GONE
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
it?.pathUrl?.let { HistoryManager.getBooInfo(it) { saveItem(it) } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// onNextClickAction?.let { it() }
|
||||
moveToNext(currentBooinfo?.pathUrl ?: mBaseWebContentsViewer.webview.url?.toUri()?.path)
|
||||
}
|
||||
}
|
||||
|
||||
@ -709,21 +657,20 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
if (it.size > 0) {
|
||||
realm.copyFromRealm(it.first())?.let {
|
||||
runOnUiThread {
|
||||
paged_layer.setTextSize(it.textSize?.toFloat()?: 14f)
|
||||
paged_layer.setLineSpacing(it.lineSpace?.toFloat() ?: 1f)
|
||||
paged_layer.setLetterSpacing(it.letterSpace?.toFloat() ?: 1f)
|
||||
var typeface = typesfacez.get(getIndex(typesfacez as PairArray<Any>,it.font ?: ""))
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
paged_layer?.setTypeface(resources.getFont(typeface.second))
|
||||
}
|
||||
paged_layer.setPadding(
|
||||
it.padding ?: 1,
|
||||
it.padding ?: 1,
|
||||
it.padding ?: 1,
|
||||
it.padding ?: 1)
|
||||
|
||||
var typeface = typesfacez.get(getIndex(typesfacez as PairArray<Any>,it.font ?: ""))
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
paged_layer?.setTypeface(resources.getFont(typeface.second))
|
||||
}
|
||||
val color = colorz.get(it.style ?: 0)
|
||||
paged_layer?.setColorStyle(color.second)
|
||||
paged_layer.setTextSize(it.textSize?.toFloat()?: 14f)
|
||||
paged_layer.setLineSpacing(it.lineSpace?.toFloat() ?: 1f)
|
||||
paged_layer.setLetterSpacing(it.letterSpace?.toFloat() ?: 1f)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -735,84 +682,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
paged_layer!!.doPrev(fast)
|
||||
updateLastInfo(paged_layer!!)
|
||||
} else {
|
||||
if (currentBooinfo != null) {
|
||||
HistoryManager.getPrevPage(currentBooinfo!!.pathUrl!!) {
|
||||
Blog.LOGE("HistoryManager.getNextPage(${it})")
|
||||
if (it?.contents?.length ?: 0 > 10) {
|
||||
currentBooinfo = it
|
||||
paged_layer.text = it!!.contents!!
|
||||
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!!)
|
||||
}
|
||||
}
|
||||
applyReaderConfig()
|
||||
} else {
|
||||
if(it?.pathUrl?.length ?: 0 > 0) {
|
||||
Blog.LOGE("HistoryManager.getNextPage(${it?.pathUrl})")
|
||||
if (lastInfo?.pageUrl?.length ?: 0 > 0 && lastInfo?.pageUrl!!.startsWith("http")) {
|
||||
Blog.LOGE("HistoryManager.getNextPage(${lastInfo?.pageUrl})")
|
||||
paged_layer.visibility = GONE
|
||||
mBaseWebContentsViewer.webview.loadUrl(lastInfo!!.pageUrl!!.replace(Uri.parse(lastInfo!!.pageUrl)!!.path!!,it?.pathUrl!!))
|
||||
} else {
|
||||
Blog.LOGE("HistoryManager.getNextPage(${Booktoki.getLastedDoamin()})")
|
||||
paged_layer.visibility = GONE
|
||||
mBaseWebContentsViewer.webview.loadUrl(Booktoki.getLastedDoamin() + it?.pathUrl!!)
|
||||
}
|
||||
HistoryManager.save(historyItem = HistoryItem().putHistory(it,mBaseWebContentsViewer.webview.url!!))
|
||||
}
|
||||
}
|
||||
if(it?.pathUrl?.length ?: 0 > 0) {
|
||||
it?.pathUrl?.let {
|
||||
HistoryManager.getBooInfo(it) {
|
||||
saveItem(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Uri.parse(mBaseWebContentsViewer.webview.url)?.let {
|
||||
it.path?.let {
|
||||
HistoryManager.getPrevPage(it) {
|
||||
if (it?.contents?.length ?: 0 > 10) {
|
||||
currentBooinfo = it
|
||||
paged_layer.text = it!!.contents!!
|
||||
paged_layer.visibility = VISIBLE
|
||||
}
|
||||
|
||||
if (it?.pathUrl?.length ?: 0 > 0) {
|
||||
HistoryManager.save(
|
||||
historyItem = HistoryItem().putHistory(
|
||||
it,
|
||||
mBaseWebContentsViewer.webview.url!!
|
||||
)
|
||||
)
|
||||
if (lastInfo?.pageUrl?.length ?: 0 > 0 && lastInfo?.pageUrl!!.startsWith(
|
||||
"http"
|
||||
)
|
||||
) {
|
||||
mBaseWebContentsViewer.webview.loadUrl(
|
||||
lastInfo!!.pageUrl!!.replace(
|
||||
Uri.parse(lastInfo!!.pageUrl)!!.path!!,
|
||||
it?.pathUrl!!
|
||||
)
|
||||
)
|
||||
} else {
|
||||
mBaseWebContentsViewer.webview.loadUrl(Booktoki.getLastedDoamin() + it?.pathUrl!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// onPrevClickAction?.let{ it() }
|
||||
moveToPrev(currentBooinfo?.pathUrl ?: mBaseWebContentsViewer.webview.url?.toUri()?.path)
|
||||
}
|
||||
}
|
||||
|
||||
@ -862,21 +732,21 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
contents = (contents.replace("\\n", System.getProperty("line.separator")))
|
||||
mPagedTextViewInterface = this@Intro
|
||||
if(lastInfo != null && mBaseWebContentsViewer.webview.url?.endsWith(lastInfo!!.pageUrl) ?: false) {
|
||||
this@Intro.findViewById<ProgressBar>(R.id.progress)?.visibility = VISIBLE
|
||||
paged_layer?.postDelayed({
|
||||
this@Intro.findViewById<ProgressBar>(R.id.progress)?.visibility = GONE
|
||||
binding.progress.visibility = VISIBLE
|
||||
paged_layer.postDelayed({
|
||||
binding.progress.visibility = GONE
|
||||
},1000)
|
||||
}
|
||||
applyReaderConfig()
|
||||
runOnUiThread {
|
||||
text = contents
|
||||
visibility = VISIBLE
|
||||
}
|
||||
applyReaderConfig()
|
||||
forceUpdateUI()
|
||||
mBaseWebContentsViewer.webview.url?.let {
|
||||
Uri.parse(it)?.let {
|
||||
it.path?.let {
|
||||
HistoryManager.getBooPageInfo(it){
|
||||
HistoryManager.getBookPageInfo(it){
|
||||
currentBooinfo = it
|
||||
currentChapter = it?.chapterNum ?: 0
|
||||
currentPage = it?.chapterNum ?: 0
|
||||
@ -912,7 +782,6 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
builder.setNegativeButton(
|
||||
"Cancel"
|
||||
) { dialog, which -> dialog.cancel() }
|
||||
|
||||
builder.show()
|
||||
}
|
||||
var testRegex = """[^0-9]""".toRegex();
|
||||
@ -947,7 +816,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
lastInfo.displayOrientation = configuration?.orientation ?: ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
||||
saveLastInfo(lastInfo)
|
||||
}
|
||||
findViewById<ProgressBar>(R.id.progress).visibility = GONE
|
||||
binding.progress.visibility = GONE
|
||||
}
|
||||
|
||||
fun saveLastInfo(lastInfo: LastInfo) {
|
||||
@ -980,6 +849,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
this.query<LastInfo>()?.find()?.last()?.let{
|
||||
it.displayOrientation = configuration.orientation
|
||||
it.title = currentTitle
|
||||
// it.pageUrl = currentBooinfo?.pathUrl ?: mBaseWebContentsViewer.webview.url?.toUri()?.path ?: ""
|
||||
it.chapter = currentChapter
|
||||
it.pageIndex = pagedTextLayout.current()
|
||||
this@Intro.lastInfo = copyFromRealm(it)
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
package com.mime.dualscreenview.common
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import com.mime.dualscreenview.webcontents.contentsinfo.Booktoki
|
||||
|
||||
object PrefManager {
|
||||
private val mainName = "Main_Pref_"
|
||||
private val domainKey = "Last_Domain_"
|
||||
private lateinit var main : SharedPreferences
|
||||
fun init(context: Context) {
|
||||
main = context.getSharedPreferences(mainName,Context.MODE_PRIVATE)
|
||||
}
|
||||
|
||||
fun save(key : String, value : String?) {
|
||||
main.edit().putString(key,value).apply()
|
||||
}
|
||||
fun load(key : String) : String? {
|
||||
return main.getString(key, "")
|
||||
}
|
||||
|
||||
fun getLastDomain() : String {
|
||||
return main.getString(domainKey, Booktoki.getLastedDoamin()) ?: Booktoki.getLastedDoamin()
|
||||
}
|
||||
fun putLastDomain(domain : String) {
|
||||
Blog.LOGE("domain >>> ${domain}")
|
||||
main.edit().putString(domainKey,domain).apply()
|
||||
}
|
||||
}
|
||||
@ -9,7 +9,6 @@ import com.mime.dualscreenview.data.model.ReaderConfig
|
||||
import io.realm.kotlin.Realm
|
||||
import io.realm.kotlin.RealmConfiguration
|
||||
import io.realm.kotlin.UpdatePolicy
|
||||
import io.realm.kotlin.log.LogLevel
|
||||
import io.realm.kotlin.types.BaseRealmObject
|
||||
import io.realm.kotlin.types.TypedRealmObject
|
||||
import kotlin.reflect.KClass
|
||||
@ -54,11 +53,15 @@ object HistoryManager {
|
||||
}
|
||||
}
|
||||
|
||||
fun getBooInfo(url : String ,callback : (BookPageInfos?)->Unit) {
|
||||
fun getBookInfos(aUrl : String, callback : (BookPageInfos?)->Unit) {
|
||||
var url : String = aUrl
|
||||
openRealm.apply{
|
||||
Blog.LOGE("get ${url}" )
|
||||
Blog.LOGE("get ${this.query(BookPageInfo::class).count().find()}" )
|
||||
var bookPageInfo = this.query(BookPageInfo::class).query("pathUrl == $0","${url}").find()
|
||||
if (url.startsWith("//")) {
|
||||
while (url.startsWith("//")) {
|
||||
url = url.replace("//","/").trim()
|
||||
}
|
||||
}
|
||||
var bookPageInfo = this.query(BookPageInfo::class).query("pathUrl == $0 || bookPageUrl == $1","${url}","${url}").find()
|
||||
if (bookPageInfo != null && bookPageInfo.count() > 0) {
|
||||
Blog.LOGE("get ${bookPageInfo}" )
|
||||
this.query(BookPageInfos::class,"bookPageUrl == $0",bookPageInfo.first().bookPageUrl).find().first().let {
|
||||
@ -71,10 +74,14 @@ object HistoryManager {
|
||||
}
|
||||
}
|
||||
|
||||
fun getBooPageInfo(url : String ,callback : (BookPageInfo?)->Unit) {
|
||||
fun getBookPageInfo(aUrl : String, callback : (BookPageInfo?)->Unit) {
|
||||
var url : String = aUrl
|
||||
openRealm.apply{
|
||||
Blog.LOGE("get ${url}" )
|
||||
Blog.LOGE("get ${this.query(BookPageInfo::class).count().find()}" )
|
||||
if (url.startsWith("//")) {
|
||||
while (url.startsWith("//")) {
|
||||
url = url.replace("//","/").trim()
|
||||
}
|
||||
}
|
||||
var result = this.query(BookPageInfo::class).query("pathUrl == $0","${url}").find()
|
||||
if (result.size > 0) {
|
||||
var bookPageInfo = result?.first()
|
||||
@ -85,10 +92,10 @@ object HistoryManager {
|
||||
}
|
||||
}
|
||||
|
||||
fun getBooPageInfoContentsSave(url : String, contents : String) {
|
||||
fun getBooPageInfoContentsSave(aUrl : String, contents : String) {
|
||||
var url : String = aUrl
|
||||
openRealm.writeBlocking {
|
||||
Blog.LOGE("get ${url}")
|
||||
Blog.LOGE("get ${query(BookPageInfo::class).count().find()}")
|
||||
Blog.LOGE("getBooPageInfoContentsSave ${url}")
|
||||
val result = query(BookPageInfo::class).query("pathUrl == $0", "${url}").find()
|
||||
if (result.size > 0) {
|
||||
result.first().contents = contents
|
||||
@ -100,42 +107,55 @@ object HistoryManager {
|
||||
|
||||
|
||||
|
||||
fun getNextPage(url : String ,callback : (BookPageInfo?)->Unit) {
|
||||
fun getNextPage(aUrl : String ,callback : (BookPageInfo?)->Unit) {
|
||||
var url : String = aUrl
|
||||
openRealm.apply{
|
||||
Blog.LOGE("getNextPage ${url}" )
|
||||
Blog.LOGE("getNextPage ${this.query(BookPageInfo::class).count().find()}" )
|
||||
var bookPageInfo = this.query(BookPageInfo::class).query("pathUrl == $0","${url}").find()?.first()
|
||||
Blog.LOGE("getNextPage 1 ${bookPageInfo}" )
|
||||
if (bookPageInfo != null) {
|
||||
Blog.LOGE("getNextPage 2 ${bookPageInfo.chapterNum}" )
|
||||
Blog.LOGE("getNextPage 2 ${bookPageInfo.bookPageUrl}" )
|
||||
var results = this.query(BookPageInfo::class).query("chapterNum == $0",bookPageInfo.chapterNum + 1).query("bookPageUrl == $0","${bookPageInfo.bookPageUrl}").find()
|
||||
if(results.size > 0) {
|
||||
results.first().let {
|
||||
Blog.LOGE("getNextPage 2 ${it.pathUrl}" )
|
||||
callback.invoke(it)
|
||||
|
||||
}
|
||||
if (url.startsWith("//")) {
|
||||
while (url.startsWith("//")) {
|
||||
url = url.replace("//","/").trim()
|
||||
}
|
||||
}
|
||||
var bookPageInfo =
|
||||
this.query(BookPageInfo::class).query("pathUrl == $0", url).find()
|
||||
if (bookPageInfo.size > 0) {
|
||||
Blog.LOGE("getNextPage 2 => chapterNum : ${bookPageInfo.first().chapterNum} , bookPageInfo.bookPageUrl : ${bookPageInfo.first().bookPageUrl}" )
|
||||
var results = this.query(BookPageInfo::class).query("chapterNum == $0",bookPageInfo.first().chapterNum + 1).query("bookPageUrl == $0","${bookPageInfo.first().bookPageUrl}").find()
|
||||
if(results.size > 0) {
|
||||
results.first().let {
|
||||
Blog.LOGE("getNextPage 2 nextBook pathUrl : ${it.pathUrl}" )
|
||||
callback.invoke(it)
|
||||
}
|
||||
} else {callback.invoke(null)}
|
||||
} else {callback.invoke(null)}
|
||||
}
|
||||
}
|
||||
|
||||
fun getPrevPage(url : String ,callback : (BookPageInfo?)->Unit) {
|
||||
fun getPrevPage(aUrl : String ,callback : (BookPageInfo?)->Unit) {
|
||||
var url : String = aUrl
|
||||
openRealm.apply{
|
||||
Blog.LOGE("getPrevPage ${url}" )
|
||||
Blog.LOGE("getPrevPage ${this.query(BookPageInfo::class).count().find()}" )
|
||||
var bookPageInfo = this.query(BookPageInfo::class).query("pathUrl == $0","${url}").find()?.first()
|
||||
Blog.LOGE("getNextPage ${bookPageInfo}" )
|
||||
if (bookPageInfo != null) {
|
||||
Blog.LOGE("getNextPage 2 ${bookPageInfo.chapterNum}" )
|
||||
Blog.LOGE("getNextPage 2 ${bookPageInfo.bookPageUrl}" )
|
||||
var results = this.query(BookPageInfo::class).query("chapterNum == $0 && bookPageUrl == $1",bookPageInfo.chapterNum - 1,"${bookPageInfo.bookPageUrl}").find()
|
||||
if (url.startsWith("//")) {
|
||||
while (url.startsWith("//")) {
|
||||
url = url.replace("//","/").trim()
|
||||
}
|
||||
}
|
||||
Blog.LOGE("getPrevPage ${url}" )
|
||||
var bookPageInfo =
|
||||
this.query(BookPageInfo::class).query("pathUrl == $0", url).find()
|
||||
Blog.LOGE("getPrevPage ${bookPageInfo}" )
|
||||
if (bookPageInfo.size > 0) {
|
||||
Blog.LOGE("getPrevPage 2 ${bookPageInfo?.first()?.chapterNum}" )
|
||||
Blog.LOGE("getPrevPage 2 ${bookPageInfo?.first()?.bookPageUrl}" )
|
||||
var results = this.query(BookPageInfo::class).query("chapterNum == $0",bookPageInfo.first().chapterNum - 1).query("bookPageUrl == $0","${bookPageInfo.first().bookPageUrl}").find()
|
||||
if(results.size > 0) {
|
||||
results.first()?.let {
|
||||
callback.invoke(it)
|
||||
}
|
||||
} else {
|
||||
callback.invoke(null)
|
||||
}
|
||||
} else {
|
||||
callback.invoke(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,14 +37,21 @@ class PagedTextLayout : ConstraintLayout , PagedTextGenerateInterface {
|
||||
var hiddenTextView : PagedTextView? = null
|
||||
var guideLine : Guideline? = null
|
||||
var pageList: ArrayList<CharSequence>? = null
|
||||
var summaryText : String = ""
|
||||
var text : String = ""
|
||||
set(new) {
|
||||
Blog.LOGE("field >> ${field}")
|
||||
Blog.LOGE("new >> ${new}")
|
||||
field = new
|
||||
Blog.LOGE("field >> ${field}")
|
||||
hiddenTextView?.setTxtF(field)
|
||||
hiddenTextView?.visibility = VISIBLE
|
||||
val summary = new.replace(" " ,"").replace("\n" ,"").substring(0,Math.min(30,new.length))
|
||||
if (summary.equals(summaryText)) {
|
||||
|
||||
} else {
|
||||
Blog.LOGE("field >> ${field}")
|
||||
hiddenTextView?.setTxtF(field)
|
||||
hiddenTextView?.visibility = VISIBLE
|
||||
}
|
||||
summaryText = summary
|
||||
}
|
||||
|
||||
private val hanler = Handler()
|
||||
|
||||
@ -7,6 +7,7 @@ import android.os.Build
|
||||
import android.text.Layout
|
||||
import android.text.StaticLayout
|
||||
import android.util.AttributeSet
|
||||
import android.util.TypedValue
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.core.view.marginBottom
|
||||
import androidx.core.view.marginLeft
|
||||
@ -86,8 +87,15 @@ class PagedTextView : AppCompatTextView {
|
||||
super.setText(text, type)
|
||||
}
|
||||
|
||||
|
||||
|
||||
override fun setTextSize(size: Float) {
|
||||
setTextSize(TypedValue.COMPLEX_UNIT_SP, size)
|
||||
}
|
||||
|
||||
override fun setTextSize(unit: Int, size: Float) {
|
||||
super.setTextSize(unit, size)
|
||||
paint.textSize = TypedValue.applyDimension(unit, size, context.resources.getDisplayMetrics())
|
||||
needPaginate = true
|
||||
}
|
||||
|
||||
@ -111,6 +119,7 @@ class PagedTextView : AppCompatTextView {
|
||||
override fun setTypeface(tf: Typeface?) {
|
||||
if (typeface != null && tf != typeface) {
|
||||
needPaginate = true
|
||||
paint.typeface = tf
|
||||
}
|
||||
super.setTypeface(tf)
|
||||
}
|
||||
@ -230,7 +239,7 @@ class PagedTextView : AppCompatTextView {
|
||||
.setUseLineSpacingFromFallbacks()
|
||||
.setBreakStrategy(breakStrategy)
|
||||
.setHyphenationFrequency(hyphenationFrequency)
|
||||
.setJustificationMode()
|
||||
// .setJustificationMode()
|
||||
.setMaxLines(maxLines)
|
||||
.build()
|
||||
}
|
||||
|
||||
@ -10,14 +10,14 @@ import com.mime.dualscreenview.webcontents.contentsinfo.DidFindContents
|
||||
abstract class BaseWebContents : ContentsInfoInterface {
|
||||
open var lastNumber : Int = 221
|
||||
var completeAction : ActionByBool? = null
|
||||
val definedActionCount = 5
|
||||
var completeActionCount = 0
|
||||
set(value) {
|
||||
field = value
|
||||
if(field == definedActionCount && completeAction != null) {
|
||||
completeAction?.invoke(true)
|
||||
}
|
||||
}
|
||||
// val definedActionCount = 5
|
||||
// var completeActionCount = 0
|
||||
// set(value) {
|
||||
// field = value
|
||||
// if(field == definedActionCount && completeAction != null) {
|
||||
// completeAction?.invoke(true)
|
||||
// }
|
||||
// }
|
||||
|
||||
fun findListItem(webview: WebView, callBakItems : DidFindContents) {
|
||||
webview.evaluateJavascript(getContentsList()) { result ->
|
||||
@ -25,16 +25,15 @@ abstract class BaseWebContents : ContentsInfoInterface {
|
||||
}
|
||||
}
|
||||
|
||||
fun doOnloaded(webview: WebView, findContents : DidFindContents, findTitle : DidFindContents, findNextButton : DidFindContents,
|
||||
findPrevButton : DidFindContents, completeAction : ActionByBool) {
|
||||
completeActionCount = 0
|
||||
fun doOnloaded(webview: WebView, findContents : DidFindContents, completeAction : ActionByBool) {
|
||||
// completeActionCount = 0
|
||||
this.completeAction = completeAction
|
||||
webview.evaluateJavascript(getTitleJs()) { result : String? ->
|
||||
result?.let { resultString ->
|
||||
findTitle.invoke(resultString)
|
||||
}
|
||||
completeActionCount = completeActionCount + 1
|
||||
}
|
||||
// webview.evaluateJavascript(getTitleJs()) { result : String? ->
|
||||
// result?.let { resultString ->
|
||||
// findTitle.invoke(resultString)
|
||||
// }
|
||||
// completeActionCount = completeActionCount + 1
|
||||
// }
|
||||
webview.evaluateJavascript(getFindContentsJs()) { result : String? ->
|
||||
result?.let { resultString ->
|
||||
checkCorrectContents(resultString)?.let { contents ->
|
||||
@ -45,37 +44,38 @@ abstract class BaseWebContents : ContentsInfoInterface {
|
||||
}
|
||||
}
|
||||
} ?: findContents.invoke(null)
|
||||
completeActionCount = completeActionCount + 1
|
||||
}
|
||||
webview.evaluateJavascript("document.getElementById('${getNextButtonJs()}')") { result : String? ->
|
||||
result?.let { resultString ->
|
||||
Log.e("BaseWebContents", "getNextButtonJs() >> ${resultString}")
|
||||
if(resultString != null && !"null".equals(resultString)) {
|
||||
findNextButton.invoke(resultString)
|
||||
} else {
|
||||
findNextButton.invoke(null)
|
||||
}
|
||||
}
|
||||
completeActionCount = completeActionCount + 1
|
||||
// completeActionCount = completeActionCount + 1
|
||||
}
|
||||
// webview.evaluateJavascript("document.getElementById('${getNextButtonJs()}')") { result : String? ->
|
||||
// result?.let { resultString ->
|
||||
// Log.e("BaseWebContents", "getNextButtonJs() >> ${resultString}")
|
||||
// if(resultString != null && !"null".equals(resultString)) {
|
||||
// findNextButton.invoke(resultString)
|
||||
// } else {
|
||||
// findNextButton.invoke(null)
|
||||
// }
|
||||
// }
|
||||
// completeActionCount = completeActionCount + 1
|
||||
// }
|
||||
|
||||
|
||||
webview.evaluateJavascript("document.getElementById('${getPrevButtonJs()}')") { result : String? ->
|
||||
result?.let { resultString ->
|
||||
Log.e("BaseWebContents", "getPrevButtonJs() >> ${resultString}")
|
||||
if(resultString != null && !"null".equals(resultString)) {
|
||||
findPrevButton.invoke(resultString)
|
||||
}else {
|
||||
findPrevButton.invoke(null)
|
||||
}
|
||||
}
|
||||
completeActionCount = completeActionCount + 1
|
||||
}
|
||||
// webview.evaluateJavascript("document.getElementById('${getPrevButtonJs()}')") { result : String? ->
|
||||
// result?.let { resultString ->
|
||||
// Log.e("BaseWebContents", "getPrevButtonJs() >> ${resultString}")
|
||||
// if(resultString != null && !"null".equals(resultString)) {
|
||||
// findPrevButton.invoke(resultString)
|
||||
// }else {
|
||||
// findPrevButton.invoke(null)
|
||||
// }
|
||||
// }
|
||||
// completeActionCount = completeActionCount + 1
|
||||
// }
|
||||
|
||||
webview.evaluateJavascript(onLoadedJs()) {
|
||||
Log.e("BaseWebContents", "onLoadedJs() >> ${it}")
|
||||
completeActionCount = completeActionCount + 1
|
||||
// completeActionCount = completeActionCount + 1
|
||||
}
|
||||
completeAction?.invoke(true)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,7 +6,9 @@ import android.net.Uri
|
||||
import android.net.http.SslError
|
||||
import android.util.Log
|
||||
import android.webkit.*
|
||||
import androidx.core.net.toUri
|
||||
import com.mime.dualscreenview.common.Blog
|
||||
import com.mime.dualscreenview.common.PrefManager
|
||||
import com.mime.dualscreenview.data.HistoryManager
|
||||
import com.mime.dualscreenview.data.model.LastInfo
|
||||
import com.mime.dualscreenview.webcontents.contentsinfo.Booktoki
|
||||
@ -76,32 +78,16 @@ open class BaseWebContentsViewer {
|
||||
|
||||
fun loadLastInfo(lastInfo: LastInfo) {
|
||||
lastInfo?.let { last ->
|
||||
Blog.LOGE("last.pageUrl >>> ${last.pageUrl}")
|
||||
currentContentsProvider = WebContentsManger.getBaseWebContentsBy(last.contentsName)
|
||||
// HistoryManager.getBooPageInfo(last.pageUrl,{ page ->
|
||||
// if(page != null){
|
||||
// if(page.contents?.length ?: 0 > 0) {
|
||||
// mainControllInterface?.onLoadedContents(page.contents!!)
|
||||
// } else {
|
||||
// webview.loadUrl(last.pageUrl)
|
||||
// }
|
||||
// } else {
|
||||
if (last.pageUrl.startsWith("https://")) {
|
||||
webview.loadUrl(last.pageUrl)
|
||||
} else {
|
||||
try {
|
||||
var uri = Uri.parse(webview.url)
|
||||
uri.path?.let {
|
||||
webview.loadUrl(uri.toString().replace(it,last.pageUrl))
|
||||
}
|
||||
webview.loadUrl(PrefManager.getLastDomain().plus("/").plus(last.pageUrl))
|
||||
} catch (e : Exception) {
|
||||
webview.loadUrl(Booktoki.getLastedDoamin().plus(last.pageUrl))
|
||||
webview.loadUrl(PrefManager.getLastDomain())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// }
|
||||
// })
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,48 +112,7 @@ open class BaseWebContentsViewer {
|
||||
super.onPageStarted(view, url, favicon)
|
||||
mainControllInterface?.onStartLoad()
|
||||
}
|
||||
var alertDialogs : ArrayList<AlertDialog> = arrayListOf()
|
||||
// override fun onReceivedError(
|
||||
// view: WebView?,
|
||||
// request: WebResourceRequest?,
|
||||
// error: WebResourceError?
|
||||
// ) {
|
||||
// super.onReceivedError(view, request, error)
|
||||
// if (error != null && error.errorCode < 0) {
|
||||
//
|
||||
// webview.postDelayed({
|
||||
// val builder = AlertDialog.Builder(webview.context)
|
||||
//
|
||||
//
|
||||
// builder.setTitle("로딩 에러").setMessage("${currentContentsProvider?.getWebcontentsName()} ${currentContentsProvider?.lastNumber?.inc()} 여기로 다시 시도?!!")
|
||||
// builder.setPositiveButton(
|
||||
// "오키 ${currentContentsProvider?.lastNumber?.inc()} 레고!"
|
||||
// ) { dialog, id ->
|
||||
// dialog.dismiss()
|
||||
// currentContentsProvider?.lastNumber = currentContentsProvider?.lastNumber!!.inc()
|
||||
// loadContents(currentContentsProvider!!)
|
||||
// }
|
||||
//
|
||||
// builder.setNegativeButton(
|
||||
// "포기하자"
|
||||
// ) { dialog, id ->
|
||||
// dialog.dismiss()
|
||||
// }
|
||||
// builder.setNeutralButton(
|
||||
// "같은 주소로 다시 도전"
|
||||
// ) { dialog, id ->
|
||||
// loadContents(currentContentsProvider!!)
|
||||
// dialog.dismiss()
|
||||
// }
|
||||
// alertDialogs.add(builder.create())
|
||||
//
|
||||
// alertDialogs.last()?.show()
|
||||
//
|
||||
// },500)
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
|
||||
override fun onReceivedSslError(
|
||||
view: WebView?,
|
||||
handler: SslErrorHandler?,
|
||||
@ -189,6 +134,9 @@ open class BaseWebContentsViewer {
|
||||
override fun onPageFinished(view: WebView?, url: String?) {
|
||||
super.onPageFinished(view, url)
|
||||
view?.let {
|
||||
url?.toUri()?.let {
|
||||
PrefManager.putLastDomain(it.scheme.plus("::/").plus(it.host))
|
||||
}
|
||||
|
||||
if(url?.contains("/list/") ?: false && url?.contains("agit") ?: false){
|
||||
findListItem {
|
||||
@ -199,24 +147,13 @@ open class BaseWebContentsViewer {
|
||||
Blog.LOGE("onPageFinished", url ?: "")
|
||||
}
|
||||
}
|
||||
|
||||
currentContentsProvider?.doOnloaded(it , { result ->
|
||||
result?.let { mainControllInterface.onLoadedContents(it) }
|
||||
} , {
|
||||
it?.let { mainControllInterface.onFindTitle(it.replace("\"","")) }
|
||||
}, {btn ->
|
||||
mainControllInterface?.showNextBtn (btn != null){
|
||||
webview?.evaluateJavascript("if(document.getElementById('${currentContentsProvider!!.getNextButtonJs()}') != null) document.getElementById('${currentContentsProvider!!.getNextButtonJs()}').click()") {
|
||||
}
|
||||
}
|
||||
},{btn ->
|
||||
mainControllInterface?.showPrevBtn(btn != null) {
|
||||
webview?.evaluateJavascript("if(document.getElementById('${currentContentsProvider!!.getPrevButtonJs()}') != null) document.getElementById('${currentContentsProvider!!.getPrevButtonJs()}').click()") {
|
||||
}
|
||||
}
|
||||
}, { complete ->
|
||||
} , { complete ->
|
||||
if(complete) {
|
||||
mainControllInterface?.completePageLoad(LastInfo().apply {
|
||||
this.pageUrl = url ?: currentContentsProvider?.getLastedDoamin() ?: ""
|
||||
this.pageUrl = url?.toUri()?.path ?: currentContentsProvider?.getLastedDoamin() ?: ""
|
||||
this.contentsName = currentContentsProvider?.getWebcontentsName() ?: ""
|
||||
this.pageIndex = 0
|
||||
})
|
||||
|
||||
@ -1,181 +1,182 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/intro_bg"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activity.Intro">
|
||||
|
||||
<WebView
|
||||
android:id="@+id/hidden_web"
|
||||
android:layout_margin="60dp"
|
||||
<layout>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/intro_bg"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
tools:context=".activity.Intro">
|
||||
|
||||
<WebView
|
||||
android:id="@+id/hidden_web"
|
||||
android:layout_margin="60dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
|
||||
|
||||
<WebView
|
||||
android:id="@+id/menu_web"
|
||||
android:layout_margin="20dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/btn_left"
|
||||
app:layout_constraintTop_toBottomOf="@id/textview_title" />
|
||||
<WebView
|
||||
android:id="@+id/menu_web"
|
||||
android:layout_margin="20dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/btn_left"
|
||||
app:layout_constraintTop_toBottomOf="@id/textview_title" />
|
||||
|
||||
|
||||
|
||||
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterButton
|
||||
android:id="@+id/btn_home"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/main_top_height"
|
||||
android:background="@android:color/transparent"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/home"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="MissingConstraints" />
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterButton
|
||||
android:id="@+id/btn_home"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/main_top_height"
|
||||
android:background="@android:color/transparent"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/home"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/main_top_height"
|
||||
android:text="@string/app_name"
|
||||
android:gravity="center"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintRight_toLeftOf="@id/btn_list"
|
||||
app:layout_constraintLeft_toRightOf="@id/btn_home"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<TextView
|
||||
android:id="@+id/textview_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/main_top_height"
|
||||
android:text="@string/app_name"
|
||||
android:gravity="center"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintRight_toLeftOf="@id/btn_list"
|
||||
app:layout_constraintLeft_toRightOf="@id/btn_home"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterButton
|
||||
android:background="@android:color/transparent"
|
||||
android:id="@+id/btn_list"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/main_top_height"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/bookmark"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/textview_title"
|
||||
app:layout_constraintRight_toLeftOf="@+id/btn_history"
|
||||
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||
/>
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterButton
|
||||
android:background="@android:color/transparent"
|
||||
android:id="@+id/btn_list"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/main_top_height"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/bookmark"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/textview_title"
|
||||
app:layout_constraintRight_toLeftOf="@+id/btn_history"
|
||||
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||
/>
|
||||
|
||||
<!-- <androidx.constraintlayout.utils.widget.ImageFilterButton-->
|
||||
<!-- android:id="@+id/btn_rotate"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="@dimen/main_top_height"-->
|
||||
<!-- android:adjustViewBounds="true"-->
|
||||
<!-- android:scaleType="centerInside"-->
|
||||
<!-- android:visibility="gone"-->
|
||||
<!-- android:src="@drawable/rotation"-->
|
||||
<!-- android:background="#8FFF"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- app:layout_constraintLeft_toRightOf="@id/btn_list"-->
|
||||
<!-- app:layout_constraintRight_toLeftOf="@+id/btn_history"-->
|
||||
<!-- app:layout_constraintHorizontal_chainStyle="spread_inside"-->
|
||||
<!-- />-->
|
||||
<!-- <androidx.constraintlayout.utils.widget.ImageFilterButton-->
|
||||
<!-- android:id="@+id/btn_rotate"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="@dimen/main_top_height"-->
|
||||
<!-- android:adjustViewBounds="true"-->
|
||||
<!-- android:scaleType="centerInside"-->
|
||||
<!-- android:visibility="gone"-->
|
||||
<!-- android:src="@drawable/rotation"-->
|
||||
<!-- android:background="#8FFF"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- app:layout_constraintLeft_toRightOf="@id/btn_list"-->
|
||||
<!-- app:layout_constraintRight_toLeftOf="@+id/btn_history"-->
|
||||
<!-- app:layout_constraintHorizontal_chainStyle="spread_inside"-->
|
||||
<!-- />-->
|
||||
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterButton
|
||||
android:id="@+id/btn_history"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/main_top_height"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/saved"
|
||||
android:background="@android:color/transparent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||
/>
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterButton
|
||||
android:id="@+id/btn_history"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/main_top_height"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/saved"
|
||||
android:background="@android:color/transparent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||
/>
|
||||
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterButton
|
||||
android:id="@+id/btn_left"
|
||||
android:layout_width="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:layout_height="@dimen/main_top_height"
|
||||
android:tag="1"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterButton
|
||||
android:id="@+id/btn_left"
|
||||
android:layout_width="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:layout_height="@dimen/main_top_height"
|
||||
android:tag="1"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
|
||||
android:text="@string/display_the_second_screen"
|
||||
android:visibility="visible"
|
||||
android:src="@drawable/angle_left"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
/>
|
||||
android:text="@string/display_the_second_screen"
|
||||
android:visibility="visible"
|
||||
android:src="@drawable/angle_left"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
/>
|
||||
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterButton
|
||||
android:id="@+id/btn_setting"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@drawable/settings"
|
||||
android:layout_height="@dimen/main_top_height"
|
||||
android:scaleType="fitCenter"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@android:color/transparent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@+id/btn_left"
|
||||
app:layout_constraintRight_toLeftOf="@+id/btn_right"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
/>
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterButton
|
||||
android:id="@+id/btn_setting"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@drawable/settings"
|
||||
android:layout_height="@dimen/main_top_height"
|
||||
android:scaleType="fitCenter"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@android:color/transparent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@+id/btn_left"
|
||||
app:layout_constraintRight_toLeftOf="@+id/btn_right"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
/>
|
||||
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterButton
|
||||
android:id="@+id/btn_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/main_top_height"
|
||||
android:layout_marginStart="16dp"
|
||||
android:tag="0"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@drawable/angle_right"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintHorizontal_chainStyle="spread" />
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterButton
|
||||
android:id="@+id/btn_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/main_top_height"
|
||||
android:layout_marginStart="16dp"
|
||||
android:tag="0"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@drawable/angle_right"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintHorizontal_chainStyle="spread" />
|
||||
|
||||
|
||||
<com.mime.dualscreenview.view.PagedTextLayout
|
||||
android:id="@+id/paged_layer"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
android:elevation="5dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/btn_setting"
|
||||
app:layout_constraintTop_toBottomOf="@id/textview_title" />
|
||||
<com.mime.dualscreenview.view.PagedTextLayout
|
||||
android:id="@+id/paged_layer"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
android:elevation="5dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/btn_setting"
|
||||
app:layout_constraintTop_toBottomOf="@id/textview_title" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="48dp"
|
||||
android:indeterminate="false"
|
||||
android:max="100"
|
||||
android:progressBackgroundTint="#FBE7C6"
|
||||
android:progressDrawable="@drawable/circle_progressbar"
|
||||
android:progressTint="#edbf41"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="48dp"
|
||||
android:indeterminate="false"
|
||||
android:max="100"
|
||||
android:progressBackgroundTint="#FBE7C6"
|
||||
android:progressDrawable="@drawable/circle_progressbar"
|
||||
android:progressTint="#edbf41"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<!--//style="@style/Widget.AppCompat.ProgressBar.Horizontal"-->
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
Loading…
x
Reference in New Issue
Block a user