...
This commit is contained in:
parent
ac6523b2dd
commit
0fff1f5aa3
@ -184,7 +184,6 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
HistoryManager.getBookPageInfo(Uri.parse(lastInfo!!.pageUrl!!).path!!) {
|
||||
it?.let {
|
||||
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!!))
|
||||
@ -206,26 +205,11 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
HistoryManager.openRealm.query<ReaderConfig>()?.find()?.let {
|
||||
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)
|
||||
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)
|
||||
}
|
||||
applyReaderConfig()
|
||||
}
|
||||
}
|
||||
}
|
||||
paged_layer.text = it!!.contents!!
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -622,7 +606,6 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
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!!))
|
||||
@ -632,6 +615,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
HistoryManager.save(historyItem = HistoryItem().putHistory(it,mBaseWebContentsViewer.webview.url!!))
|
||||
}
|
||||
applyReaderConfig()
|
||||
paged_layer.text = it!!.contents!!
|
||||
} else {
|
||||
if(it?.pathUrl?.length ?: 0 > 0) {
|
||||
if (lastInfo?.pageUrl?.length ?: 0 > 0 && lastInfo?.pageUrl!!.startsWith("http")) {
|
||||
@ -680,16 +664,18 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
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)
|
||||
|
||||
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)
|
||||
paged_layer.setPadding(
|
||||
it.padding ?: 1,
|
||||
it.padding ?: 1,
|
||||
it.padding ?: 1,
|
||||
it.padding ?: 1)
|
||||
paged_layer.invalidate()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ class PagedTextView : AppCompatTextView {
|
||||
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
||||
super.onSizeChanged(w, h, oldw, oldh)
|
||||
Blog.LOGD(log = "onSizeChanged>> ${this::class.java.name}")
|
||||
pageHeight = ((h - (marginTop + marginBottom + paddingTop + paddingBottom)) * 0.8f).toInt()
|
||||
pageHeight = ((h - (marginTop + marginBottom + paddingTop + paddingBottom)) * 1f).toInt()
|
||||
}
|
||||
|
||||
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
|
||||
@ -190,7 +190,7 @@ class PagedTextView : AppCompatTextView {
|
||||
val layout = from(layout)
|
||||
val lines = if(min(maxLines, layout.lineCount) > 10) {min(maxLines, layout.lineCount) - 1} else {min(maxLines, layout.lineCount)}
|
||||
var startOffset = 0
|
||||
val heightWithoutPaddings = pageHeight - (marginTop + marginBottom + paddingTop + paddingBottom)
|
||||
val heightWithoutPaddings = pageHeight //- (marginTop + marginBottom + paddingTop + paddingBottom)
|
||||
var height = heightWithoutPaddings
|
||||
|
||||
for (i in 0 until lines) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user