This commit is contained in:
lunaticbum 2024-08-26 14:34:32 +09:00
parent 7fe2cd5674
commit 90e28a9b45
10 changed files with 495 additions and 625 deletions

View File

@ -6,6 +6,7 @@
<application <application
android:allowBackup="false" android:allowBackup="false"
android:name=".BaseAppication"
android:dataExtractionRules="@xml/data_extraction_rules" android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules" android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"

View File

@ -1,11 +1,12 @@
package com.mime.dualscreenview package com.mime.dualscreenview
import android.app.Application import android.app.Application
import com.mime.dualscreenview.common.PrefManager
import io.realm.kotlin.Realm import io.realm.kotlin.Realm
class BaseAppication : Application() { class BaseAppication : Application() {
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
PrefManager.init(this)
} }
} }

View File

@ -1,16 +1,16 @@
package com.mime.dualscreenview.activity package com.mime.dualscreenview.activity
import android.content.ComponentName
import android.content.DialogInterface import android.content.DialogInterface
import android.content.Intent import android.content.Intent
import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo
import android.content.pm.PackageManager.NameNotFoundException
import android.content.res.Configuration import android.content.res.Configuration
import android.graphics.Bitmap import android.graphics.Bitmap
import android.net.ConnectivityManager
import android.net.Uri import android.net.Uri
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.os.Looper
import android.os.Message import android.os.Message
import android.text.InputType import android.text.InputType
import android.text.SpannableStringBuilder import android.text.SpannableStringBuilder
@ -26,17 +26,18 @@ import android.webkit.WebView
import android.webkit.WebViewClient import android.webkit.WebViewClient
import android.widget.ArrayAdapter import android.widget.ArrayAdapter
import android.widget.EditText import android.widget.EditText
import android.widget.ImageButton
import android.widget.ProgressBar import android.widget.ProgressBar
import android.widget.TextView import android.widget.TextView
import android.widget.Toast import android.widget.Toast
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.constraintlayout.utils.widget.ImageFilterButton import androidx.constraintlayout.utils.widget.ImageFilterButton
import androidx.core.net.toUri
import com.google.gson.Gson import com.google.gson.Gson
import com.mime.dualscreenview.R import com.mime.dualscreenview.R
import com.mime.dualscreenview.common.Blog import com.mime.dualscreenview.common.Blog
import com.mime.dualscreenview.common.PairArray import com.mime.dualscreenview.common.PairArray
import com.mime.dualscreenview.common.PrefManager
import com.mime.dualscreenview.common.colorz import com.mime.dualscreenview.common.colorz
import com.mime.dualscreenview.common.getIndex import com.mime.dualscreenview.common.getIndex
import com.mime.dualscreenview.common.typesfacez 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.HistoryItem
import com.mime.dualscreenview.data.model.LastInfo import com.mime.dualscreenview.data.model.LastInfo
import com.mime.dualscreenview.data.model.ReaderConfig import com.mime.dualscreenview.data.model.ReaderConfig
import com.mime.dualscreenview.databinding.IntroBinding
import com.mime.dualscreenview.dialog.DefaultList import com.mime.dualscreenview.dialog.DefaultList
import com.mime.dualscreenview.view.PagedTextLayout import com.mime.dualscreenview.view.PagedTextLayout
import com.mime.dualscreenview.view.PagedTextViewInterface 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.UpdatePolicy
import io.realm.kotlin.ext.copyFromRealm import io.realm.kotlin.ext.copyFromRealm
import io.realm.kotlin.ext.query 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.lang.System.currentTimeMillis
import java.text.Normalizer
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Date import java.util.Date
import java.util.regex.Pattern
import kotlin.random.Random import kotlin.random.Random
class Intro : Base() , MainControllInterface, PagedTextViewInterface { class Intro : Base() , MainControllInterface, PagedTextViewInterface {
// Save previous state of dual screens
private lateinit var mBaseWebContentsViewer : BaseWebContentsViewer private lateinit var mBaseWebContentsViewer : BaseWebContentsViewer
var lastInfo : LastInfo? = null var lastInfo : LastInfo? = null
lateinit var paged_layer : PagedTextLayout lateinit var paged_layer : PagedTextLayout
lateinit var textview_title : TextView lateinit var textview_title : TextView
var currentBooinfo : BookPageInfo? = null var currentBooinfo : BookPageInfo? = null
val handle = object : Handler() {
val handle = object : Handler(Looper.getMainLooper()) {
override fun handleMessage(msg: Message) { override fun handleMessage(msg: Message) {
// super.handleMessage(msg)
if (msg.what == 0 ) { if (msg.what == 0 ) {
(msg.obj as? ReaderConfig)?.let { (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) { override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig) super.onConfigurationChanged(newConfig)
Blog.LOGD(log= "onConfigurationChanged ${this::class.java.name} >> newConfig ${newConfig}") Blog.LOGD(log= "onConfigurationChanged ${this::class.java.name} >> newConfig ${newConfig}")
@ -99,11 +98,13 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
} }
var contentsSaver : WebView? = null var contentsSaver : WebView? = null
lateinit var binding : IntroBinding
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
Blog.LOGD(log= "onCreate ${this::class.java.name} >> savedInstanceState ${savedInstanceState}") Blog.LOGD(log= "onCreate ${this::class.java.name} >> savedInstanceState ${savedInstanceState}")
setContentView(R.layout.intro) binding = IntroBinding.inflate(layoutInflater)
findViewById<WebView>(R.id.menu_web)?.let { setContentView(binding.root)
binding.menuWeb.let {
it.setOnLongClickListener { it.setOnLongClickListener {
onTouch(TouchArea.Center) onTouch(TouchArea.Center)
return@setOnLongClickListener false return@setOnLongClickListener false
@ -111,19 +112,19 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
mBaseWebContentsViewer = BaseWebContentsViewer(it,this) mBaseWebContentsViewer = BaseWebContentsViewer(it,this)
} }
paged_layer = findViewById<PagedTextLayout>(R.id.paged_layer) paged_layer = binding.pagedLayer
textview_title = findViewById<TextView>(R.id.textview_title) textview_title = binding.textviewTitle
findViewById<ImageButton>(R.id.btn_list).setOnClickListener { v -> binding.btnList.setOnClickListener { v ->
mBaseWebContentsViewer?.webview?.url?.let { mBaseWebContentsViewer?.webview?.url?.let {
Uri.parse(it).path?.let { Uri.parse(it).path?.let {
HistoryManager.getBooInfo(it, { HistoryManager.getBookInfos(it, {
it?.let { showList(it) } it?.let { showList(it) }
}) })
} }
} }
} }
findViewById<WebView>(R.id.hidden_web)?.let { v-> binding.hiddenWeb?.let { v->
contentsSaver = v contentsSaver = v
contentsSaver?.webViewClient = saveClient contentsSaver?.webViewClient = saveClient
contentsSaver?.settings?.textZoom = 100 contentsSaver?.settings?.textZoom = 100
@ -141,46 +142,19 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
// switcvhOrient() // switcvhOrient()
// } // }
findViewById<View>(R.id.btn_setting).setOnClickListener { v-> binding.btnSetting.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)
startActivity(Intent(this@Intro, Settings::class.java)) startActivity(Intent(this@Intro, Settings::class.java))
} }
findViewById<View>(R.id.btn_history).setOnClickListener { v-> binding.btnHistory.setOnClickListener { v->
var realm = openRealm() var realm = openRealm()
realm.query<HistoryItem>()?.find()?.let { realm.query<HistoryItem>().find().let {
showHistory(realm.copyFromRealm(it)) showHistory(realm.copyFromRealm(it))
} }
} }
binding.btnHome.setOnClickListener { v->
findViewById<View>(R.id.btn_home).setOnClickListener { v-> paged_layer.visibility = GONE
paged_layer?.visibility = GONE
mBaseWebContentsViewer.loadContents(Booktoki) mBaseWebContentsViewer.loadContents(Booktoki)
} }
@ -189,10 +163,10 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
fun loadLastInfo(){ fun loadLastInfo(){
val realm = openRealm() val realm = openRealm()
try { lastInfo = realm?.query<LastInfo>()?.find()?.last()?.copyFromRealm() try { lastInfo = realm.query<LastInfo>().find().last()?.copyFromRealm()
try { try {
if (lastInfo != null) { if (lastInfo != null) {
HistoryManager.getBooPageInfo(Uri.parse(lastInfo!!.pageUrl!!).path!!) { HistoryManager.getBookPageInfo(Uri.parse(lastInfo!!.pageUrl!!).path!!) {
it?.let { it?.let {
currentBooinfo = it currentBooinfo = it
paged_layer.text = it!!.contents!! paged_layer.text = it!!.contents!!
@ -208,7 +182,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
mBaseWebContentsViewer.webview.loadUrl(Booktoki.getLastedDoamin() + it?.pathUrl!!) mBaseWebContentsViewer.webview.loadUrl(Booktoki.getLastedDoamin() + it?.pathUrl!!)
} }
it?.pathUrl?.let { it?.pathUrl?.let {
HistoryManager.getBooInfo(it) { HistoryManager.getBookInfos(it) {
saveItem(it) saveItem(it)
} }
} }
@ -245,6 +219,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
}} catch (e : Exception) { } }} catch (e : Exception) { }
} }
fun reloadLastInfo() { fun reloadLastInfo() {
val configuration: Configuration = getResources().getConfiguration() val configuration: Configuration = getResources().getConfiguration()
if(lastInfo != null && lastInfo?.displayOrientation != configuration.orientation) { if(lastInfo != null && lastInfo?.displayOrientation != configuration.orientation) {
@ -258,15 +233,9 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
var infos : BookPageInfos? = null var infos : BookPageInfos? = null
realm.writeBlocking { realm.writeBlocking {
try { try {
var infosj : BookPageInfosJ? = null var infosj : BookPageInfosJ? = null
infosj = Gson().fromJson(jsonString, BookPageInfosJ::class.java) infosj = Gson().fromJson(jsonString, BookPageInfosJ::class.java)
Blog.LOGE("onBookInfos" , "onBookInfos 2 >> ${infosj}") HistoryManager.getBookInfos(infosj.bookPageUrl!!){
Blog.LOGE("onBookInfos" , "onBookInfos 2 - 1 >> ${infosj?.pages}")
// realm.createObjectFromJson
Blog.LOGE("onBookInfos" , "onBookInfos 2 - 1 >> ${infosj?.getR()}")
HistoryManager.getBooInfo(infosj.bookPageUrl!!){
if (it != null) { if (it != null) {
infos = copyToRealm(it!!, UpdatePolicy.ALL) infos = copyToRealm(it!!, UpdatePolicy.ALL)
@ -275,8 +244,9 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
infos!!.pages.add(item.getRealm()) infos!!.pages.add(item.getRealm())
} }
} }
Blog.LOGE("onBookInfos", "onBookInfos 3 >> ${realm.query<BookPageInfos>().find().size}") if (infos != null) {
Blog.LOGE("onBookInfos", "onBookInfos 4 >> ${realm.query<BookPageInfo>().find().size}") infos = this.copyFromRealm(infos!!)
}
} else { } else {
infos = infosj?.getR() infos = infosj?.getR()
if (infos != null) { if (infos != null) {
@ -284,25 +254,24 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
for (item in infosj.pages) { for (item in infosj.pages) {
infos?.pages?.add(item.getRealm()) 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) { } catch (e :Exception) {
e.printStackTrace() e.printStackTrace()
} } finally {
} infos?.bookPageUrl?.let {
HistoryManager.getBookInfos(it){
infos?.bookPageUrl?.let { it?.let {
HistoryManager.getBooInfo(it){ Blog.LOGE("onBookInfos" , "onBookInfos it >> ${it}")
it?.let { runOnUiThread {
Blog.LOGE("onBookInfos" , "onBookInfos it >> ${it}") showList(it)
runOnUiThread { }
showList(it) }
} }
} }
} }
@ -376,7 +345,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
builderInner.setPositiveButton("Ok", builderInner.setPositiveButton("Ok",
DialogInterface.OnClickListener { DialogInterface.OnClickListener {
dialog, which -> dialog, which ->
reloadTo(item.makeLastInfo()) contentsLoad(item.pageUrl)
dialog.dismiss() dialog.dismiss()
}) })
builderInner.setNeutralButton("삭제", builderInner.setNeutralButton("삭제",
@ -456,62 +425,88 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
override fun onPageFinished(webView: WebView?, url: String?) { override fun onPageFinished(webView: WebView?, url: String?) {
super.onPageFinished(webView, url) super.onPageFinished(webView, url)
isLoading = false isLoading = false
var ramdomTimeSec = 1000L + Random(System.currentTimeMillis()).nextLong().rem(3999) webView?.postDelayed({ autoScrollDown(webView, url) },(1300L + Random(System.currentTimeMillis()).nextLong().rem(1286L)))
Blog.LOGE("ramdomTime >>> ${ramdomTimeSec}") }
webView?.postDelayed( { fun showToast(origin: String) {
Blog.LOGE("saveClient >>> ${isLoading} ${url}") runOnUiThread {
var findContents = Booktoki.getFindContentsJs() val biggerText = SpannableStringBuilder(origin)
webView?.evaluateJavascript(findContents){ result: String? -> biggerText.setSpan(RelativeSizeSpan(1.6f), 0, origin.length, 0)
result?.let { string: String -> Toast.makeText(
Blog.LOGE("saveClient contents >>> ${string.length}") baseContext,
if (string.length > 10) { biggerText,
Blog.LOGE("saveClient it.length >>> ${string.length}") Toast.LENGTH_SHORT
var contents = string.replace("\\\"","\"") ).show()
contents = (contents.replace("\\n", System.getProperty("line.separator"))) }
contents = (contents.replace("\\n", System.getProperty("line.separator"))) }
Blog.LOGE("saveClient contents >>> ${contents.length}") fun autoScrollDown(webView: WebView?, url: String?) {
Uri.parse(url)?.let { webView?.let { webView ->
it.path?.let { val ramdomTimeSec =
HistoryManager.getBooPageInfoContentsSave(it, contents.replace(Char(0x20).toString()," ")) 800L.plus(Random(System.currentTimeMillis()).nextLong().rem(789L))
HistoryManager.getBooPageInfo(it) { info -> Blog.LOGE("ramdomTime >>> ${ramdomTimeSec}")
runOnUiThread { if (((webView?.scrollY ?: 0) + (webView?.height
info?.let { ?: 0)) < webView?.contentHeight ?: 0
var origin = info.getTitleItem() ) {
val biggerText = SpannableStringBuilder(origin) webView?.postDelayed({
biggerText.setSpan(RelativeSizeSpan(1.6f), 0, origin.length, 0) webView?.pageDown(false)
Toast.makeText(baseContext,biggerText, Toast.LENGTH_SHORT).apply { autoScrollDown(webView, url)
setGravity(Gravity.CENTER, 0, 0) }, ramdomTimeSec)
}.show() } 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) }, ramdomTimeSec)
Blog.LOGE("ramdomTime >>> ${ramdomTime}") }
contentsSaver?.postDelayed( { saveItem(null) }, ramdomTime) }
}
}},ramdomTimeSec)
} }
} }
var saveTarget : ArrayList<BookPageInfo> = arrayListOf() var saveTarget : ArrayList<BookPageInfo> = arrayListOf()
private fun saveItem(infos: BookPageInfos?) { private fun saveItem(infos: BookPageInfos?) {
Blog.LOGE("saveItem >>> infos?.pages ${infos?.pages?.size ?: 0}") 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}") Blog.LOGE("saveItem >>> targetCount = ${savedCount}")
infos?.pages?.reversed()?.forEach { infos?.pages?.reversed()?.forEach {
if ((it.contents?.length ?: 0) > 10) { if ((it.contents?.length ?: 0) > 10) {
} else { } else {
if (saveTarget.size < savedCount.toInt()) { if (savedCount.toInt() > 0) {
saveTarget.add(it) 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()}") Blog.LOGE("saveItem >>> saveTarget ${saveTarget.count()}")
if (isLoading == false) { if (isLoading == false) {
try { try {
@ -578,117 +573,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) { 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) ) { if (paged_layer != null && paged_layer!!.visibility == View.VISIBLE && paged_layer!!.size() > 0 && (paged_layer!!.current() < paged_layer!!.size() - 1) ) {
paged_layer!!.doNext(fast) paged_layer!!.doNext(fast)
updateLastInfo(paged_layer!!) updateLastInfo(paged_layer!!)
} else { } else {
val pathUrl = currentBooinfo?.pathUrl moveToNext(currentBooinfo?.pathUrl ?: mBaseWebContentsViewer.webview.url?.toUri()?.path)
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() }
} }
} }
@ -709,21 +652,20 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
if (it.size > 0) { if (it.size > 0) {
realm.copyFromRealm(it.first())?.let { realm.copyFromRealm(it.first())?.let {
runOnUiThread { runOnUiThread {
paged_layer.setTextSize(it.textSize?.toFloat()?: 14f) var typeface = typesfacez.get(getIndex(typesfacez as PairArray<Any>,it.font ?: ""))
paged_layer.setLineSpacing(it.lineSpace?.toFloat() ?: 1f) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
paged_layer.setLetterSpacing(it.letterSpace?.toFloat() ?: 1f) paged_layer?.setTypeface(resources.getFont(typeface.second))
}
paged_layer.setPadding( paged_layer.setPadding(
it.padding ?: 1, it.padding ?: 1,
it.padding ?: 1, it.padding ?: 1,
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) val color = colorz.get(it.style ?: 0)
paged_layer?.setColorStyle(color.second) 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 +677,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
paged_layer!!.doPrev(fast) paged_layer!!.doPrev(fast)
updateLastInfo(paged_layer!!) updateLastInfo(paged_layer!!)
} else { } else {
if (currentBooinfo != null) { moveToPrev(currentBooinfo?.pathUrl ?: mBaseWebContentsViewer.webview.url?.toUri()?.path)
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() }
} }
} }
@ -862,21 +727,21 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
contents = (contents.replace("\\n", System.getProperty("line.separator"))) contents = (contents.replace("\\n", System.getProperty("line.separator")))
mPagedTextViewInterface = this@Intro mPagedTextViewInterface = this@Intro
if(lastInfo != null && mBaseWebContentsViewer.webview.url?.endsWith(lastInfo!!.pageUrl) ?: false) { if(lastInfo != null && mBaseWebContentsViewer.webview.url?.endsWith(lastInfo!!.pageUrl) ?: false) {
this@Intro.findViewById<ProgressBar>(R.id.progress)?.visibility = VISIBLE binding.progress.visibility = VISIBLE
paged_layer?.postDelayed({ paged_layer.postDelayed({
this@Intro.findViewById<ProgressBar>(R.id.progress)?.visibility = GONE binding.progress.visibility = GONE
},1000) },1000)
} }
applyReaderConfig()
runOnUiThread { runOnUiThread {
text = contents text = contents
visibility = VISIBLE visibility = VISIBLE
} }
applyReaderConfig()
forceUpdateUI() forceUpdateUI()
mBaseWebContentsViewer.webview.url?.let { mBaseWebContentsViewer.webview.url?.let {
Uri.parse(it)?.let { Uri.parse(it)?.let {
it.path?.let { it.path?.let {
HistoryManager.getBooPageInfo(it){ HistoryManager.getBookPageInfo(it){
currentBooinfo = it currentBooinfo = it
currentChapter = it?.chapterNum ?: 0 currentChapter = it?.chapterNum ?: 0
currentPage = it?.chapterNum ?: 0 currentPage = it?.chapterNum ?: 0
@ -912,7 +777,6 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
builder.setNegativeButton( builder.setNegativeButton(
"Cancel" "Cancel"
) { dialog, which -> dialog.cancel() } ) { dialog, which -> dialog.cancel() }
builder.show() builder.show()
} }
var testRegex = """[^0-9]""".toRegex(); var testRegex = """[^0-9]""".toRegex();
@ -947,7 +811,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
lastInfo.displayOrientation = configuration?.orientation ?: ActivityInfo.SCREEN_ORIENTATION_PORTRAIT lastInfo.displayOrientation = configuration?.orientation ?: ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
saveLastInfo(lastInfo) saveLastInfo(lastInfo)
} }
findViewById<ProgressBar>(R.id.progress).visibility = GONE binding.progress.visibility = GONE
} }
fun saveLastInfo(lastInfo: LastInfo) { fun saveLastInfo(lastInfo: LastInfo) {
@ -980,6 +844,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
this.query<LastInfo>()?.find()?.last()?.let{ this.query<LastInfo>()?.find()?.last()?.let{
it.displayOrientation = configuration.orientation it.displayOrientation = configuration.orientation
it.title = currentTitle it.title = currentTitle
// it.pageUrl = currentBooinfo?.pathUrl ?: mBaseWebContentsViewer.webview.url?.toUri()?.path ?: ""
it.chapter = currentChapter it.chapter = currentChapter
it.pageIndex = pagedTextLayout.current() it.pageIndex = pagedTextLayout.current()
this@Intro.lastInfo = copyFromRealm(it) this@Intro.lastInfo = copyFromRealm(it)

View File

@ -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()
}
}

View File

@ -9,7 +9,6 @@ import com.mime.dualscreenview.data.model.ReaderConfig
import io.realm.kotlin.Realm import io.realm.kotlin.Realm
import io.realm.kotlin.RealmConfiguration import io.realm.kotlin.RealmConfiguration
import io.realm.kotlin.UpdatePolicy import io.realm.kotlin.UpdatePolicy
import io.realm.kotlin.log.LogLevel
import io.realm.kotlin.types.BaseRealmObject import io.realm.kotlin.types.BaseRealmObject
import io.realm.kotlin.types.TypedRealmObject import io.realm.kotlin.types.TypedRealmObject
import kotlin.reflect.KClass 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{ openRealm.apply{
Blog.LOGE("get ${url}" ) if (url.startsWith("//")) {
Blog.LOGE("get ${this.query(BookPageInfo::class).count().find()}" ) while (url.startsWith("//")) {
var bookPageInfo = this.query(BookPageInfo::class).query("pathUrl == $0","${url}").find() url = url.replace("//","/").trim()
}
}
var bookPageInfo = this.query(BookPageInfo::class).query("pathUrl == $0 || bookPageUrl == $1","${url}","${url}").find()
if (bookPageInfo != null && bookPageInfo.count() > 0) { if (bookPageInfo != null && bookPageInfo.count() > 0) {
Blog.LOGE("get ${bookPageInfo}" ) Blog.LOGE("get ${bookPageInfo}" )
this.query(BookPageInfos::class,"bookPageUrl == $0",bookPageInfo.first().bookPageUrl).find().first().let { 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{ openRealm.apply{
Blog.LOGE("get ${url}" ) if (url.startsWith("//")) {
Blog.LOGE("get ${this.query(BookPageInfo::class).count().find()}" ) while (url.startsWith("//")) {
url = url.replace("//","/").trim()
}
}
var result = this.query(BookPageInfo::class).query("pathUrl == $0","${url}").find() var result = this.query(BookPageInfo::class).query("pathUrl == $0","${url}").find()
if (result.size > 0) { if (result.size > 0) {
var bookPageInfo = result?.first() 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 { openRealm.writeBlocking {
Blog.LOGE("get ${url}") Blog.LOGE("getBooPageInfoContentsSave ${url}")
Blog.LOGE("get ${query(BookPageInfo::class).count().find()}")
val result = query(BookPageInfo::class).query("pathUrl == $0", "${url}").find() val result = query(BookPageInfo::class).query("pathUrl == $0", "${url}").find()
if (result.size > 0) { if (result.size > 0) {
result.first().contents = contents 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{ openRealm.apply{
Blog.LOGE("getNextPage ${url}" ) if (url.startsWith("//")) {
Blog.LOGE("getNextPage ${this.query(BookPageInfo::class).count().find()}" ) while (url.startsWith("//")) {
var bookPageInfo = this.query(BookPageInfo::class).query("pathUrl == $0","${url}").find()?.first() url = url.replace("//","/").trim()
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)
}
} }
} }
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{ openRealm.apply{
Blog.LOGE("getPrevPage ${url}" ) Blog.LOGE("getPrevPage ${url}" )
Blog.LOGE("getPrevPage ${this.query(BookPageInfo::class).count().find()}" ) if (url.startsWith("//")) {
var bookPageInfo = this.query(BookPageInfo::class).query("pathUrl == $0","${url}").find()?.first() while (url.startsWith("//")) {
Blog.LOGE("getNextPage ${bookPageInfo}" ) url = url.replace("//","/").trim()
if (bookPageInfo != null) { }
Blog.LOGE("getNextPage 2 ${bookPageInfo.chapterNum}" ) }
Blog.LOGE("getNextPage 2 ${bookPageInfo.bookPageUrl}" ) Blog.LOGE("getPrevPage ${url}" )
var results = this.query(BookPageInfo::class).query("chapterNum == $0 && bookPageUrl == $1",bookPageInfo.chapterNum - 1,"${bookPageInfo.bookPageUrl}").find() 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) { if(results.size > 0) {
results.first()?.let { results.first()?.let {
callback.invoke(it) callback.invoke(it)
} }
} else {
callback.invoke(null)
} }
} else {
callback.invoke(null)
} }
} }
} }

View File

@ -37,14 +37,21 @@ class PagedTextLayout : ConstraintLayout , PagedTextGenerateInterface {
var hiddenTextView : PagedTextView? = null var hiddenTextView : PagedTextView? = null
var guideLine : Guideline? = null var guideLine : Guideline? = null
var pageList: ArrayList<CharSequence>? = null var pageList: ArrayList<CharSequence>? = null
var summaryText : String = ""
var text : String = "" var text : String = ""
set(new) { set(new) {
Blog.LOGE("field >> ${field}") Blog.LOGE("field >> ${field}")
Blog.LOGE("new >> ${new}") Blog.LOGE("new >> ${new}")
field = new field = new
Blog.LOGE("field >> ${field}") val summary = new.replace(" " ,"").replace("\n" ,"").substring(0,Math.min(30,new.length))
hiddenTextView?.setTxtF(field) if (summary.equals(summaryText)) {
hiddenTextView?.visibility = VISIBLE
} else {
Blog.LOGE("field >> ${field}")
hiddenTextView?.setTxtF(field)
hiddenTextView?.visibility = VISIBLE
}
summaryText = summary
} }
private val hanler = Handler() private val hanler = Handler()

View File

@ -7,6 +7,7 @@ import android.os.Build
import android.text.Layout import android.text.Layout
import android.text.StaticLayout import android.text.StaticLayout
import android.util.AttributeSet import android.util.AttributeSet
import android.util.TypedValue
import androidx.appcompat.widget.AppCompatTextView import androidx.appcompat.widget.AppCompatTextView
import androidx.core.view.marginBottom import androidx.core.view.marginBottom
import androidx.core.view.marginLeft import androidx.core.view.marginLeft
@ -86,8 +87,15 @@ class PagedTextView : AppCompatTextView {
super.setText(text, type) super.setText(text, type)
} }
override fun setTextSize(size: Float) {
setTextSize(TypedValue.COMPLEX_UNIT_SP, size)
}
override fun setTextSize(unit: Int, size: Float) { override fun setTextSize(unit: Int, size: Float) {
super.setTextSize(unit, size) super.setTextSize(unit, size)
paint.textSize = TypedValue.applyDimension(unit, size, context.resources.getDisplayMetrics())
needPaginate = true needPaginate = true
} }
@ -111,6 +119,7 @@ class PagedTextView : AppCompatTextView {
override fun setTypeface(tf: Typeface?) { override fun setTypeface(tf: Typeface?) {
if (typeface != null && tf != typeface) { if (typeface != null && tf != typeface) {
needPaginate = true needPaginate = true
paint.typeface = tf
} }
super.setTypeface(tf) super.setTypeface(tf)
} }
@ -230,7 +239,7 @@ class PagedTextView : AppCompatTextView {
.setUseLineSpacingFromFallbacks() .setUseLineSpacingFromFallbacks()
.setBreakStrategy(breakStrategy) .setBreakStrategy(breakStrategy)
.setHyphenationFrequency(hyphenationFrequency) .setHyphenationFrequency(hyphenationFrequency)
.setJustificationMode() // .setJustificationMode()
.setMaxLines(maxLines) .setMaxLines(maxLines)
.build() .build()
} }

View File

@ -10,14 +10,14 @@ import com.mime.dualscreenview.webcontents.contentsinfo.DidFindContents
abstract class BaseWebContents : ContentsInfoInterface { abstract class BaseWebContents : ContentsInfoInterface {
open var lastNumber : Int = 221 open var lastNumber : Int = 221
var completeAction : ActionByBool? = null var completeAction : ActionByBool? = null
val definedActionCount = 5 // val definedActionCount = 5
var completeActionCount = 0 // var completeActionCount = 0
set(value) { // set(value) {
field = value // field = value
if(field == definedActionCount && completeAction != null) { // if(field == definedActionCount && completeAction != null) {
completeAction?.invoke(true) // completeAction?.invoke(true)
} // }
} // }
fun findListItem(webview: WebView, callBakItems : DidFindContents) { fun findListItem(webview: WebView, callBakItems : DidFindContents) {
webview.evaluateJavascript(getContentsList()) { result -> webview.evaluateJavascript(getContentsList()) { result ->
@ -25,16 +25,15 @@ abstract class BaseWebContents : ContentsInfoInterface {
} }
} }
fun doOnloaded(webview: WebView, findContents : DidFindContents, findTitle : DidFindContents, findNextButton : DidFindContents, fun doOnloaded(webview: WebView, findContents : DidFindContents, completeAction : ActionByBool) {
findPrevButton : DidFindContents, completeAction : ActionByBool) { // completeActionCount = 0
completeActionCount = 0
this.completeAction = completeAction this.completeAction = completeAction
webview.evaluateJavascript(getTitleJs()) { result : String? -> // webview.evaluateJavascript(getTitleJs()) { result : String? ->
result?.let { resultString -> // result?.let { resultString ->
findTitle.invoke(resultString) // findTitle.invoke(resultString)
} // }
completeActionCount = completeActionCount + 1 // completeActionCount = completeActionCount + 1
} // }
webview.evaluateJavascript(getFindContentsJs()) { result : String? -> webview.evaluateJavascript(getFindContentsJs()) { result : String? ->
result?.let { resultString -> result?.let { resultString ->
checkCorrectContents(resultString)?.let { contents -> checkCorrectContents(resultString)?.let { contents ->
@ -45,37 +44,38 @@ abstract class BaseWebContents : ContentsInfoInterface {
} }
} }
} ?: findContents.invoke(null) } ?: findContents.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('${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? -> // webview.evaluateJavascript("document.getElementById('${getPrevButtonJs()}')") { result : String? ->
result?.let { resultString -> // result?.let { resultString ->
Log.e("BaseWebContents", "getPrevButtonJs() >> ${resultString}") // Log.e("BaseWebContents", "getPrevButtonJs() >> ${resultString}")
if(resultString != null && !"null".equals(resultString)) { // if(resultString != null && !"null".equals(resultString)) {
findPrevButton.invoke(resultString) // findPrevButton.invoke(resultString)
}else { // }else {
findPrevButton.invoke(null) // findPrevButton.invoke(null)
} // }
} // }
completeActionCount = completeActionCount + 1 // completeActionCount = completeActionCount + 1
} // }
webview.evaluateJavascript(onLoadedJs()) { webview.evaluateJavascript(onLoadedJs()) {
Log.e("BaseWebContents", "onLoadedJs() >> ${it}") Log.e("BaseWebContents", "onLoadedJs() >> ${it}")
completeActionCount = completeActionCount + 1 // completeActionCount = completeActionCount + 1
} }
completeAction?.invoke(true)
} }
} }

View File

@ -6,7 +6,9 @@ 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 androidx.core.net.toUri
import com.mime.dualscreenview.common.Blog import com.mime.dualscreenview.common.Blog
import com.mime.dualscreenview.common.PrefManager
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.Booktoki
@ -76,32 +78,16 @@ open class BaseWebContentsViewer {
fun loadLastInfo(lastInfo: LastInfo) { fun loadLastInfo(lastInfo: LastInfo) {
lastInfo?.let { last -> lastInfo?.let { last ->
Blog.LOGE("last.pageUrl >>> ${last.pageUrl}")
currentContentsProvider = WebContentsManger.getBaseWebContentsBy(last.contentsName) 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://")) { if (last.pageUrl.startsWith("https://")) {
webview.loadUrl(last.pageUrl) webview.loadUrl(last.pageUrl)
} else { } else {
try { try {
var uri = Uri.parse(webview.url) webview.loadUrl(PrefManager.getLastDomain().plus("/").plus(last.pageUrl))
uri.path?.let {
webview.loadUrl(uri.toString().replace(it,last.pageUrl))
}
} catch (e : Exception) { } catch (e : Exception) {
webview.loadUrl(Booktoki.getLastedDoamin().plus("/").plus(last.pageUrl)) webview.loadUrl(PrefManager.getLastDomain())
} }
} }
// }
// })
} }
} }
@ -126,48 +112,7 @@ open class BaseWebContentsViewer {
super.onPageStarted(view, url, favicon) super.onPageStarted(view, url, favicon)
mainControllInterface?.onStartLoad() 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( override fun onReceivedSslError(
view: WebView?, view: WebView?,
handler: SslErrorHandler?, handler: SslErrorHandler?,
@ -189,6 +134,9 @@ open class BaseWebContentsViewer {
override fun onPageFinished(view: WebView?, url: String?) { override fun onPageFinished(view: WebView?, url: String?) {
super.onPageFinished(view, url) super.onPageFinished(view, url)
view?.let { view?.let {
url?.toUri()?.let {
PrefManager.putLastDomain(it.scheme.plus("::/").plus(it.host))
}
if(url?.contains("/list/") ?: false && url?.contains("agit") ?: false){ if(url?.contains("/list/") ?: false && url?.contains("agit") ?: false){
findListItem { findListItem {
@ -199,24 +147,13 @@ open class BaseWebContentsViewer {
Blog.LOGE("onPageFinished", url ?: "") Blog.LOGE("onPageFinished", url ?: "")
} }
} }
currentContentsProvider?.doOnloaded(it , { result -> currentContentsProvider?.doOnloaded(it , { result ->
result?.let { mainControllInterface.onLoadedContents(it) } result?.let { mainControllInterface.onLoadedContents(it) }
} , { } , { complete ->
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 ->
if(complete) { if(complete) {
mainControllInterface?.completePageLoad(LastInfo().apply { mainControllInterface?.completePageLoad(LastInfo().apply {
this.pageUrl = url ?: currentContentsProvider?.getLastedDoamin() ?: "" this.pageUrl = url?.toUri()?.path ?: currentContentsProvider?.getLastedDoamin() ?: ""
this.contentsName = currentContentsProvider?.getWebcontentsName() ?: "" this.contentsName = currentContentsProvider?.getWebcontentsName() ?: ""
this.pageIndex = 0 this.pageIndex = 0
}) })

View File

@ -1,181 +1,182 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <layout>
xmlns:app="http://schemas.android.com/apk/res-auto" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/intro_bg"
android:layout_height="match_parent"
tools:context=".activity.Intro">
<WebView
android:id="@+id/hidden_web"
android:layout_margin="60dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:id="@+id/intro_bg"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_constraintLeft_toLeftOf="parent" tools:context=".activity.Intro">
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" <WebView
app:layout_constraintBottom_toBottomOf="parent"/> 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 <WebView
android:id="@+id/menu_web" android:id="@+id/menu_web"
android:layout_margin="20dp" android:layout_margin="20dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toTopOf="@id/btn_left" app:layout_constraintBottom_toTopOf="@id/btn_left"
app:layout_constraintTop_toBottomOf="@id/textview_title" /> app:layout_constraintTop_toBottomOf="@id/textview_title" />
<androidx.constraintlayout.utils.widget.ImageFilterButton <androidx.constraintlayout.utils.widget.ImageFilterButton
android:id="@+id/btn_home" android:id="@+id/btn_home"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/main_top_height" android:layout_height="@dimen/main_top_height"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/home" android:src="@drawable/home"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:ignore="MissingConstraints" /> tools:ignore="MissingConstraints" />
<TextView <TextView
android:id="@+id/textview_title" android:id="@+id/textview_title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/main_top_height" android:layout_height="@dimen/main_top_height"
android:text="@string/app_name" android:text="@string/app_name"
android:gravity="center" android:gravity="center"
android:textSize="24sp" android:textSize="24sp"
app:layout_constraintRight_toLeftOf="@id/btn_list" app:layout_constraintRight_toLeftOf="@id/btn_list"
app:layout_constraintLeft_toRightOf="@id/btn_home" app:layout_constraintLeft_toRightOf="@id/btn_home"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.utils.widget.ImageFilterButton <androidx.constraintlayout.utils.widget.ImageFilterButton
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:id="@+id/btn_list" android:id="@+id/btn_list"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/main_top_height" android:layout_height="@dimen/main_top_height"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:scaleType="centerInside" android:scaleType="centerInside"
android:src="@drawable/bookmark" android:src="@drawable/bookmark"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toRightOf="@id/textview_title" app:layout_constraintLeft_toRightOf="@id/textview_title"
app:layout_constraintRight_toLeftOf="@+id/btn_history" app:layout_constraintRight_toLeftOf="@+id/btn_history"
app:layout_constraintHorizontal_chainStyle="spread_inside" app:layout_constraintHorizontal_chainStyle="spread_inside"
/> />
<!-- <androidx.constraintlayout.utils.widget.ImageFilterButton--> <!-- <androidx.constraintlayout.utils.widget.ImageFilterButton-->
<!-- android:id="@+id/btn_rotate"--> <!-- android:id="@+id/btn_rotate"-->
<!-- android:layout_width="wrap_content"--> <!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="@dimen/main_top_height"--> <!-- android:layout_height="@dimen/main_top_height"-->
<!-- android:adjustViewBounds="true"--> <!-- android:adjustViewBounds="true"-->
<!-- android:scaleType="centerInside"--> <!-- android:scaleType="centerInside"-->
<!-- android:visibility="gone"--> <!-- android:visibility="gone"-->
<!-- android:src="@drawable/rotation"--> <!-- android:src="@drawable/rotation"-->
<!-- android:background="#8FFF"--> <!-- android:background="#8FFF"-->
<!-- app:layout_constraintTop_toTopOf="parent"--> <!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- app:layout_constraintLeft_toRightOf="@id/btn_list"--> <!-- app:layout_constraintLeft_toRightOf="@id/btn_list"-->
<!-- app:layout_constraintRight_toLeftOf="@+id/btn_history"--> <!-- app:layout_constraintRight_toLeftOf="@+id/btn_history"-->
<!-- app:layout_constraintHorizontal_chainStyle="spread_inside"--> <!-- app:layout_constraintHorizontal_chainStyle="spread_inside"-->
<!-- />--> <!-- />-->
<androidx.constraintlayout.utils.widget.ImageFilterButton <androidx.constraintlayout.utils.widget.ImageFilterButton
android:id="@+id/btn_history" android:id="@+id/btn_history"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/main_top_height" android:layout_height="@dimen/main_top_height"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/saved" android:src="@drawable/saved"
android:background="@android:color/transparent" android:background="@android:color/transparent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintHorizontal_chainStyle="spread_inside" app:layout_constraintHorizontal_chainStyle="spread_inside"
/> />
<androidx.constraintlayout.utils.widget.ImageFilterButton <androidx.constraintlayout.utils.widget.ImageFilterButton
android:id="@+id/btn_left" android:id="@+id/btn_left"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:layout_height="@dimen/main_top_height" android:layout_height="@dimen/main_top_height"
android:tag="1" android:tag="1"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:text="@string/display_the_second_screen" android:text="@string/display_the_second_screen"
android:visibility="visible" android:visibility="visible"
android:src="@drawable/angle_left" android:src="@drawable/angle_left"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_chainStyle="spread" app:layout_constraintHorizontal_chainStyle="spread"
/> />
<androidx.constraintlayout.utils.widget.ImageFilterButton <androidx.constraintlayout.utils.widget.ImageFilterButton
android:id="@+id/btn_setting" android:id="@+id/btn_setting"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:src="@drawable/settings" android:src="@drawable/settings"
android:layout_height="@dimen/main_top_height" android:layout_height="@dimen/main_top_height"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:background="@android:color/transparent" android:background="@android:color/transparent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/btn_left" app:layout_constraintLeft_toRightOf="@+id/btn_left"
app:layout_constraintRight_toLeftOf="@+id/btn_right" app:layout_constraintRight_toLeftOf="@+id/btn_right"
app:layout_constraintHorizontal_chainStyle="spread" app:layout_constraintHorizontal_chainStyle="spread"
/> />
<androidx.constraintlayout.utils.widget.ImageFilterButton <androidx.constraintlayout.utils.widget.ImageFilterButton
android:id="@+id/btn_right" android:id="@+id/btn_right"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/main_top_height" android:layout_height="@dimen/main_top_height"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:tag="0" android:tag="0"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:src="@drawable/angle_right" android:src="@drawable/angle_right"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:visibility="visible" android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintHorizontal_chainStyle="spread" /> app:layout_constraintHorizontal_chainStyle="spread" />
<com.mime.dualscreenview.view.PagedTextLayout <com.mime.dualscreenview.view.PagedTextLayout
android:id="@+id/paged_layer" android:id="@+id/paged_layer"
android:layout_margin="1dp" android:layout_margin="1dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone" android:visibility="gone"
android:elevation="5dp" android:elevation="5dp"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toTopOf="@id/btn_setting" app:layout_constraintBottom_toTopOf="@id/btn_setting"
app:layout_constraintTop_toBottomOf="@id/textview_title" /> app:layout_constraintTop_toBottomOf="@id/textview_title" />
<ProgressBar <ProgressBar
android:id="@+id/progress" android:id="@+id/progress"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginTop="48dp" android:layout_marginTop="48dp"
android:indeterminate="false" android:indeterminate="false"
android:max="100" android:max="100"
android:progressBackgroundTint="#FBE7C6" android:progressBackgroundTint="#FBE7C6"
android:progressDrawable="@drawable/circle_progressbar" android:progressDrawable="@drawable/circle_progressbar"
android:progressTint="#edbf41" android:progressTint="#edbf41"
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<!--//style="@style/Widget.AppCompat.ProgressBar.Horizontal"--> </layout>