This commit is contained in:
lunaticbum 2023-04-06 19:18:02 +09:00
parent 271e0c66dc
commit ae743bf784
13 changed files with 722 additions and 511 deletions

View File

@ -6,31 +6,36 @@ 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.res.Configuration import android.content.res.Configuration
import android.graphics.Color
import android.hardware.display.DisplayManager import android.hardware.display.DisplayManager
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.Message import android.os.Message
import android.text.InputType
import android.util.Log import android.util.Log
import android.view.KeyEvent import android.view.KeyEvent
import android.view.View import android.view.View
import android.view.View.* import android.view.View.*
import android.webkit.WebView import android.webkit.WebView
import android.widget.ArrayAdapter import android.widget.ArrayAdapter
import android.widget.EditText
import android.widget.ImageButton import android.widget.ImageButton
import android.widget.ProgressBar import android.widget.ProgressBar
import android.widget.TextView
import android.widget.Toast import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.AppCompatButton import androidx.appcompat.widget.AppCompatButton
import com.google.gson.Gson import com.google.gson.Gson
import com.lge.display.DisplayManagerHelper import com.lge.display.DisplayManagerHelper
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.colorz
import com.mime.dualscreenview.common.getIndex
import com.mime.dualscreenview.common.typesfacez
import com.mime.dualscreenview.data.HistoryManager import com.mime.dualscreenview.data.HistoryManager
import com.mime.dualscreenview.dialog.StyleSelectInterface
import com.mime.dualscreenview.dialog.Stylez
import com.mime.dualscreenview.data.model.BookPageInfo import com.mime.dualscreenview.data.model.BookPageInfo
import com.mime.dualscreenview.data.model.BookPageInfos import com.mime.dualscreenview.data.model.BookPageInfos
import com.mime.dualscreenview.data.model.HistoryItem import com.mime.dualscreenview.data.model.HistoryItem
@ -48,6 +53,8 @@ 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.android.synthetic.main.intro.paged_layer import kotlinx.android.synthetic.main.intro.paged_layer
import kotlinx.android.synthetic.main.intro.textview_title
import kotlinx.android.synthetic.main.settings.preview
import java.lang.System.currentTimeMillis import java.lang.System.currentTimeMillis
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Date import java.util.Date
@ -234,7 +241,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
dialog, which -> dialog, which ->
var realm = openRealm() var realm = openRealm()
realm?.writeBlocking { realm?.writeBlocking {
this.query<HistoryItem>().query("title == '${item.title}'", ).find()?.last()?.let{ this.query<HistoryItem>().query("title == '${item.title}'").find()?.last()?.let{
this.delete(it) this.delete(it)
} }
} }
@ -267,28 +274,26 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
} }
private fun moveTo(item: BookPageInfo?) { private fun moveTo(item: BookPageInfo?) {
item?.link?.let {newPath -> item?.link?.let { newPath ->
mBaseWebContentsViewer?.webview?.url?.let{currentUrl -> mBaseWebContentsViewer?.webview?.url?.let { currentUrl ->
Uri.parse(currentUrl)?.lastPathSegment?.let { Uri.parse(currentUrl)?.lastPathSegment?.let {
currentUrl.replace(it,newPath)?.let { currentUrl.replace(it, newPath)?.let {
mBaseWebContentsViewer?.webview?.loadUrl(it) mBaseWebContentsViewer?.webview?.loadUrl(it)
} }
} }
} }
} }
} }
fun showStyleList() { // fun showStyleList() {
var mStylez = Stylez(this@Intro) // var mStylez = Stylez(this@Intro)
mStylez.styleSelectInterface = object : StyleSelectInterface { // mStylez.styleSelectInterface = object : StyleSelectInterface {
override fun onSelectStyle(bgColor: String, textColor: String) { // override fun onSelectStyle(bgColor: String, textColor: String) {
paged_layer?.setColorStyle(arrayOf(textColor,bgColor)) // paged_layer?.setColorStyle(arrayOf(textColor,bgColor))
} // }
} // }
mStylez.show() // mStylez.show()
} // }
override fun onDestroy() { override fun onDestroy() {
@ -486,6 +491,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
Log.i(TAG,"showAlert >> " + alert) Log.i(TAG,"showAlert >> " + alert)
} }
@RequiresApi(Build.VERSION_CODES.O)
override fun onLoadedContents(contents: String) { override fun onLoadedContents(contents: String) {
paged_layer.apply { paged_layer.apply {
if (contents != null) { if (contents != null) {
@ -503,6 +509,11 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
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 ?: ""))
paged_layer?.setTypeface(resources.getFont(typeface.second))
val color = colorz.get(it.style ?: 0)
paged_layer?.setColorStyle(color.second)
} }
} }
} }
@ -531,7 +542,26 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
var currentChapter : Int = 0 var currentChapter : Int = 0
override fun onFindTitle(contents: String) { override fun onFindTitle(contents: String) {
findViewById<TextView>(R.id.textView).text = contents textview_title.text = contents
textview_title.setOnClickListener {
val builder = AlertDialog.Builder(this)
builder.setTitle("Title")
val input = EditText(this)
input.setText(mBaseWebContentsViewer?.webview?.url ?: "")
input.inputType = InputType.TYPE_CLASS_TEXT
builder.setView(input)
builder.setPositiveButton(
"OK"
) { dialog, which ->
var m_Text = input.text.toString()
mBaseWebContentsViewer?.webview?.loadUrl(m_Text.trim())
}
builder.setNegativeButton(
"Cancel"
) { dialog, which -> dialog.cancel() }
builder.show()
}
var testRegex = """[^0-9]""".toRegex(); var testRegex = """[^0-9]""".toRegex();
Blog.LOGI(TAG,"onFindTitle >> " + contents + " ::: ${testRegex.replace(contents,"")}") Blog.LOGI(TAG,"onFindTitle >> " + contents + " ::: ${testRegex.replace(contents,"")}")
if(contents.contains("-")) { if(contents.contains("-")) {
@ -629,7 +659,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
findViewById<View>(R.id.btn_left).visibility = VISIBLE findViewById<View>(R.id.btn_left).visibility = VISIBLE
findViewById<View>(R.id.btn_setting).visibility = VISIBLE findViewById<View>(R.id.btn_setting).visibility = VISIBLE
findViewById<View>(R.id.textView).visibility = VISIBLE textview_title.visibility = VISIBLE
findViewById<View>(R.id.btn_home).visibility = VISIBLE findViewById<View>(R.id.btn_home).visibility = VISIBLE
findViewById<View>(R.id.btn_list).visibility = VISIBLE findViewById<View>(R.id.btn_list).visibility = VISIBLE
findViewById<View>(R.id.btn_history).visibility = VISIBLE findViewById<View>(R.id.btn_history).visibility = VISIBLE
@ -668,7 +698,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
findViewById<View>(R.id.btn_left).visibility = GONE findViewById<View>(R.id.btn_left).visibility = GONE
findViewById<View>(R.id.btn_setting).visibility = GONE findViewById<View>(R.id.btn_setting).visibility = GONE
findViewById<View>(R.id.textView).visibility = GONE textview_title.visibility = GONE
findViewById<View>(R.id.btn_home).visibility = GONE findViewById<View>(R.id.btn_home).visibility = GONE
findViewById<View>(R.id.btn_list).visibility = GONE findViewById<View>(R.id.btn_list).visibility = GONE
findViewById<View>(R.id.btn_history).visibility = GONE findViewById<View>(R.id.btn_history).visibility = GONE
@ -679,4 +709,4 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
companion object { companion object {
private const val TAG = "DualScreenStatus" private const val TAG = "DualScreenStatus"
} }
} }

View File

@ -1,7 +1,14 @@
package com.mime.dualscreenview.activity package com.mime.dualscreenview.activity
import android.graphics.Color
import android.os.Build
import android.os.Bundle import android.os.Bundle
import androidx.annotation.RequiresApi
import com.mime.dualscreenview.R import com.mime.dualscreenview.R
import com.mime.dualscreenview.common.PairArray
import com.mime.dualscreenview.common.colorz
import com.mime.dualscreenview.common.getIndex
import com.mime.dualscreenview.common.typesfacez
import com.mime.dualscreenview.data.HistoryManager import com.mime.dualscreenview.data.HistoryManager
import com.mime.dualscreenview.data.model.ReaderConfig import com.mime.dualscreenview.data.model.ReaderConfig
import io.realm.kotlin.UpdatePolicy import io.realm.kotlin.UpdatePolicy
@ -9,6 +16,8 @@ import io.realm.kotlin.ext.query
import kotlinx.android.synthetic.main.settings.letter_space import kotlinx.android.synthetic.main.settings.letter_space
import kotlinx.android.synthetic.main.settings.line_space import kotlinx.android.synthetic.main.settings.line_space
import kotlinx.android.synthetic.main.settings.page_padding import kotlinx.android.synthetic.main.settings.page_padding
import kotlinx.android.synthetic.main.settings.page_style
import kotlinx.android.synthetic.main.settings.page_typesface
import kotlinx.android.synthetic.main.settings.preview import kotlinx.android.synthetic.main.settings.preview
import kotlinx.android.synthetic.main.settings.text_size import kotlinx.android.synthetic.main.settings.text_size
@ -32,6 +41,7 @@ class Settings : Base() {
realm.close() realm.close()
} }
@RequiresApi(Build.VERSION_CODES.O)
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
text_size.displayFormat = "글자 크기 : %d" text_size.displayFormat = "글자 크기 : %d"
@ -77,7 +87,35 @@ class Settings : Base() {
} }
} }
page_typesface.displayFormat = "폰트 : %s"
page_typesface.titleArray = typesfacez.map { it.first }.toTypedArray()
page_typesface.value = getIndex(typesfacez as PairArray<Any>,readerConfig?.font ?: "")
page_typesface.mValueChange = {
val pair = typesfacez.get(it)
preview.setTypeface(resources.getFont(pair.second))
if (readerConfig?.font != pair.first) {
readerConfig?.font = pair.first ?: ""
configSave()
} }
}
page_style.displayFormat = "스타일 : %s"
page_style.titleArray = colorz.map { it.first }.toTypedArray()
page_style.value = readerConfig?.style ?: 0
page_style.mValueChange = {
val pair = colorz.get(it)
preview.setBackgroundColor(Color.parseColor(pair.second.last()))
preview.setTextColor(Color.parseColor(pair.second.first()))
if (readerConfig?.style != it) {
readerConfig?.style = it ?: 0
configSave()
}
}
}
fun configSave() { fun configSave() {

View File

@ -1,15 +1,39 @@
package com.mime.dualscreenview.common package com.mime.dualscreenview.common
import com.mime.dualscreenview.R
val colorz = arrayOf<Array<String>>( typealias PairArray<T> = Array<Pair<String,T>>
arrayOf<String>("#E1F5FE", "#263238"), val colorz : PairArray<Array<String>> = arrayOf<Pair<String,Array<String>>>(
arrayOf<String>("#F0F4C3", "#37474F"), Pair("color set 01",arrayOf<String>("#E1F5FE", "#263238")),
arrayOf<String>("#ECEFF1", "#455A64"), Pair("color set 02",arrayOf<String>("#F0F4C3", "#37474F")),
arrayOf<String>("#E0F7FA", "#263238"), Pair("color set 03",arrayOf<String>("#ECEFF1", "#455A64")),
arrayOf<String>("#F5F5F5", "#263238"), Pair("color set 04",arrayOf<String>("#E0F7FA", "#263238")),
arrayOf<String>("#ECEFF1", "#263238"), Pair("color set 05",arrayOf<String>("#F5F5F5", "#263238")),
arrayOf<String>("#F8BBD0", "#263238"), Pair("color set 06",arrayOf<String>("#ECEFF1", "#263238")),
arrayOf<String>("#E6EE9C", "#455A64"), Pair("color set 07",arrayOf<String>("#F8BBD0", "#263238")),
arrayOf<String>("#CFD8DC", "#455A64"), Pair("color set 08",arrayOf<String>("#E6EE9C", "#455A64")),
arrayOf<String>("#FFF59D", "#37474F") Pair("color set 09",arrayOf<String>("#CFD8DC", "#455A64")),
Pair("color set 10",arrayOf<String>("#FFF59D", "#37474F"))
) )
val typesfacez : PairArray<Int> = arrayOf<Pair<String,Int>>(
Pair("정선 아리랑 혼", R.font.jsarirang_hon),
Pair("정선 아리랑 뿌리", R.font.jsarirang_ppuri),
Pair("정선 동강 레귤러", R.font.jsdongkang_regular),
Pair("손기정체", R.font.kcc_sonkeechung),
Pair("교보 손글씨", R.font.kyobo_handwriting_2021sjy),
Pair("태백 은하수", R.font.taebaek_milkyway),
)
@JvmName("getIndexAny")
fun PairArray<Any>.getIndex(key : String) = getIndex(this, key)
fun getIndex(collection : PairArray<Any>, key : String) : Int {
var index = 0
var returns = 0
for (item in collection) {
if(item.first.equals(key)) {
returns = index
}
index = index.inc()
}
return returns
}

View File

@ -11,10 +11,10 @@ import kotlin.reflect.KClass
object HistoryManager { object HistoryManager {
val clazz : Set<KClass<out BaseRealmObject>> = setOf(LastInfo::class, HistoryItem::class, ReaderConfig::class) val clazz : Set<KClass<out BaseRealmObject>> = setOf(LastInfo::class, HistoryItem::class, ReaderConfig::class)
val schemaVersion : Long = 1 val schemaVersion : Long = 3
fun openRealm() : Realm = Realm.open(RealmConfiguration.Builder(clazz) fun openRealm() : Realm = Realm.open(RealmConfiguration.Builder(clazz)
.schemaVersion(2) .schemaVersion(schemaVersion)
.build()) .build())
fun save(lastInfo: LastInfo) { fun save(lastInfo: LastInfo) {

View File

@ -9,6 +9,7 @@ class ReaderConfig() : RealmObject {
var textSize : Int? = 14 var textSize : Int? = 14
var textColor : String? = "#FFFFFF" var textColor : String? = "#FFFFFF"
var bgColor : String? = "#000000" var bgColor : String? = "#000000"
var style : Int? = 0
var lineSpace : Int? = 1 var lineSpace : Int? = 1
var letterSpace : Int? = 1 var letterSpace : Int? = 1
var font : String? = "" var font : String? = ""

View File

@ -1,99 +1,97 @@
package com.mime.dualscreenview.dialog //package com.mime.dualscreenview.dialog
//
import android.app.Dialog //import android.app.Dialog
import android.content.Context //import android.content.Context
import android.content.DialogInterface //import android.content.DialogInterface
import android.graphics.Color //import android.graphics.Color
import android.os.Bundle //import android.os.Bundle
import android.view.LayoutInflater //import android.view.LayoutInflater
import android.view.View //import android.view.View
import android.view.ViewGroup //import android.view.ViewGroup
import android.view.Window //import android.view.Window
import android.widget.TextView //import android.widget.TextView
import androidx.recyclerview.widget.GridLayoutManager //import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager //import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView //import com.mime.dualscreenview.R
import com.mime.dualscreenview.R //import kotlin.random.Random
import com.mime.dualscreenview.common.colorz //
import kotlin.random.Random //interface StyleSelectInterface {
// fun onSelectStyle(bgColor : String, textColor : String)
interface StyleSelectInterface { //}
fun onSelectStyle(bgColor : String, textColor : String) //class Stylez : Dialog {
} // constructor(context: Context) : super(context) {initView(context)}
class Stylez : Dialog { // constructor(context: Context, themeResId: Int) : super(context, themeResId) {initView(context)}
constructor(context: Context) : super(context) {initView(context)} // constructor(
constructor(context: Context, themeResId: Int) : super(context, themeResId) {initView(context)} // context: Context,
constructor( // cancelable: Boolean,
context: Context, // cancelListener: DialogInterface.OnCancelListener?
cancelable: Boolean, // ) : super(context, cancelable, cancelListener) {initView(context)}
cancelListener: DialogInterface.OnCancelListener? //
) : super(context, cancelable, cancelListener) {initView(context)} // var styleSelectInterface : StyleSelectInterface? = null
//
var styleSelectInterface : StyleSelectInterface? = null // fun initView(context: Context) {
//
fun initView(context: Context) { // }
//
} // override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate(savedInstanceState)
override fun onCreate(savedInstanceState: Bundle?) { // this.requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState) // setCancelable(true)
this.requestWindowFeature(Window.FEATURE_NO_TITLE); // setContentView(R.layout.dialog_stylesz)
setCancelable(true) // val recyclerView: RecyclerView = findViewById(R.id.stylez_recyclerview)
setContentView(R.layout.dialog_stylesz) // val adapterRe = AdapterRe(context, colorz)
val recyclerView: RecyclerView = findViewById(R.id.stylez_recyclerview) // recyclerView.adapter = adapterRe
val adapterRe = AdapterRe(context, colorz) // recyclerView.layoutManager =
recyclerView.adapter = adapterRe // GridLayoutManager(context, 2, GridLayoutManager.VERTICAL, false)
recyclerView.layoutManager = // }
GridLayoutManager(context, 2, GridLayoutManager.VERTICAL, false) //
} // inner class AdapterRe(ctx: Context, myImageNameList: Array<Array<String>>) :
// RecyclerView.Adapter<StylezViewHolder>() {
inner class AdapterRe(ctx: Context, myImageNameList: Array<Array<String>>) : // private val inflater: LayoutInflater
RecyclerView.Adapter<StylezViewHolder>() { // private val myImageNameList: Array<Array<String>>
private val inflater: LayoutInflater // private val ctx : Context
private val myImageNameList: Array<Array<String>> // init {
private val ctx : Context // inflater = LayoutInflater.from(ctx)
init { // this.ctx = ctx
inflater = LayoutInflater.from(ctx) // this.myImageNameList = myImageNameList
this.ctx = ctx // }
this.myImageNameList = myImageNameList //
} // override fun onCreateViewHolder (
// parent: ViewGroup,
override fun onCreateViewHolder ( // viewType: Int
parent: ViewGroup, // ): StylezViewHolder {
viewType: Int // val view: View = inflater.inflate(R.layout.item_colorz, parent, false)
): StylezViewHolder { // return StylezViewHolder(view)
val view: View = inflater.inflate(R.layout.item_colorz, parent, false) // }
return StylezViewHolder(view) //
} // override fun onBindViewHolder(holder: StylezViewHolder, position: Int) {
// var colorz = myImageNameList.get(position)
override fun onBindViewHolder(holder: StylezViewHolder, position: Int) { // var sampleTextz = ctx.resources.getStringArray(R.array.sample_textz)
var colorz = myImageNameList.get(position) // holder?.setStyle(bgColor = colorz.get(1), textColor = colorz.get(0),sampleTextz.get(Random.nextInt(9876) % sampleTextz.size))
var sampleTextz = ctx.resources.getStringArray(R.array.sample_textz) // }
holder?.setStyle(bgColor = colorz.get(1), textColor = colorz.get(0),sampleTextz.get(Random.nextInt(9876) % sampleTextz.size)) //
} //
// override fun getItemCount(): Int {
// return myImageNameList.size
override fun getItemCount(): Int { // }
return myImageNameList.size //
} // }
//
} // inner class StylezViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
// var textView: TextView
inner class StylezViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { // var bg : View
var textView: TextView // init {
var bg : View // textView = itemView.findViewById(R.id.textview_sample)
init { // bg = itemView.findViewById(R.id.bg_sample)
textView = itemView.findViewById(R.id.textview_sample) // }
bg = itemView.findViewById(R.id.bg_sample) // fun setStyle(bgColor : String, textColor : String, sampleText : String ) {
} // bg.setBackgroundColor(Color.parseColor(bgColor))
fun setStyle(bgColor : String, textColor : String, sampleText : String ) { // textView.setTextColor(Color.parseColor(textColor))
bg.setBackgroundColor(Color.parseColor(bgColor)) // textView.text = sampleText
textView.setTextColor(Color.parseColor(textColor)) // itemView?.setOnClickListener { v ->
textView.text = sampleText // styleSelectInterface?.onSelectStyle(bgColor,textColor)
itemView?.setOnClickListener { v -> // dismiss()
styleSelectInterface?.onSelectStyle(bgColor,textColor) // }
dismiss() // }
} // }
} //}
}
}

View File

@ -0,0 +1,62 @@
package com.mime.dualscreenview.view
import android.content.Context
import android.util.AttributeSet
import com.mime.dualscreenview.R
import kotlinx.android.synthetic.main.layout_steps_editor.view.btn_decrement
import kotlinx.android.synthetic.main.layout_steps_editor.view.btn_increment
import kotlinx.android.synthetic.main.layout_steps_editor.view.text_value
class ScopeEditor: SideButtonTextView {
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
context,
attrs,
defStyleAttr
)
var titleArray : Array<String>? = null
set(value) {
if(value != null && value.size < 1) {
Error("titleArray는 최소 한개 이상이여야됨.")
return
}
field = value
maxValue = field!!.size
}
var maxValue : Int = 1
set(value) {
if (value < 1) {
Error("maxValue는 무조건 0보다 커야하눈뎅....")
return
}
field = value
}
override var value : Int = 14
set(newValue) {
field = newValue
text_value.text = displayFormat.format(titleArray?.get(field) ?:"defulat")
mValueChange?.invoke(field)
}
constructor(
context: Context,
attrs: AttributeSet?,
defStyleAttr: Int,
defStyleRes: Int
) : super(context, attrs, defStyleAttr, defStyleRes)
init {
inflate(context, R.layout.layout_steps_editor,this)
btn_decrement.setOnClickListener { value = Math.abs(value.dec()).rem(maxValue) }
btn_increment.setOnClickListener { value = value.inc().rem(maxValue) }
leftButtonTitle = "<"
rightButtonTitle = ">"
}
}

View File

@ -0,0 +1,70 @@
package com.mime.dualscreenview.view
import android.content.Context
import android.util.AttributeSet
import androidx.constraintlayout.widget.ConstraintLayout
import com.mime.dualscreenview.R
import kotlinx.android.synthetic.main.layout_steps_editor.view.btn_decrement
import kotlinx.android.synthetic.main.layout_steps_editor.view.btn_increment
import kotlinx.android.synthetic.main.layout_steps_editor.view.text_value
import java.lang.Exception
open class SideButtonTextView : ConstraintLayout {
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
context,
attrs,
defStyleAttr
)
constructor(
context: Context,
attrs: AttributeSet?,
defStyleAttr: Int,
defStyleRes: Int
) : super(context, attrs, defStyleAttr, defStyleRes)
var leftButtonTitle : String = ""
set(value) {
field = value
btn_decrement.text = field
}
var rightButtonTitle : String = ""
set(value) {
field = value
btn_increment.text = field
}
open var value : Int = 14
set(newValue) {
field = newValue
text_value.text = displayFormat.format(field)
mValueChange?.invoke(field)
}
var displayFormat = "글자 크기 : %d"
set(newValue) {
field = newValue
try {
text_value.text = displayFormat.format(value)
} catch (e : Exception) {
}
}
var mValueChange : ValueChange? = null
set(newValue) {
field = newValue
if (newValue != null) {
newValue(value)
}
}
init {
// inflate(context, R.layout.layout_steps_editor,this)
// btn_decrement.setOnClickListener { value = value.dec() }
// btn_increment.setOnClickListener { value = value.inc() }
}
}

View File

@ -11,7 +11,7 @@ import java.lang.Exception
typealias ValueChange = (Int)->Unit typealias ValueChange = (Int)->Unit
class StepsEditor : ConstraintLayout { class StepsEditor : SideButtonTextView {
constructor(context: Context) : super(context) constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
@ -27,33 +27,11 @@ class StepsEditor : ConstraintLayout {
defStyleRes: Int defStyleRes: Int
) : super(context, attrs, defStyleAttr, defStyleRes) ) : super(context, attrs, defStyleAttr, defStyleRes)
var value : Int = 14
set(newValue) {
field = newValue
text_value.text = displayFormat.format(field)
mValueChange?.invoke(field)
}
var displayFormat = "글자 크기 : %d"
set(newValue) {
field = newValue
try {
text_value.text = displayFormat.format(value)
} catch (e : Exception) {
}
}
var mValueChange : ValueChange? = null
set(newValue) {
field = newValue
if (newValue != null) {
newValue(value)
}
}
init { init {
inflate(context, R.layout.layout_steps_editor,this) inflate(context, R.layout.layout_steps_editor,this)
btn_decrement.setOnClickListener { value = value.dec() } btn_decrement.setOnClickListener { value = value.dec() }
btn_increment.setOnClickListener { value = value.inc() } btn_increment.setOnClickListener { value = value.inc() }
leftButtonTitle = "-"
rightButtonTitle = "+"
} }
} }

View File

@ -2,8 +2,10 @@ package com.mime.dualscreenview.webcontents
import android.app.AlertDialog import android.app.AlertDialog
import android.graphics.Bitmap import android.graphics.Bitmap
import android.net.http.SslError
import android.util.Log import android.util.Log
import android.webkit.* import android.webkit.*
import com.mime.dualscreenview.common.Blog
import com.mime.dualscreenview.data.model.LastInfo import com.mime.dualscreenview.data.model.LastInfo
import com.mime.dualscreenview.webcontents.contentsinfo.DidFindContents import com.mime.dualscreenview.webcontents.contentsinfo.DidFindContents
@ -119,21 +121,23 @@ open class BaseWebContentsViewer {
// //
// } // }
// //
// override fun onReceivedSslError( override fun onReceivedSslError(
// view: WebView?, view: WebView?,
// handler: SslErrorHandler?, handler: SslErrorHandler?,
// error: SslError? error: SslError?
// ) { ) {
//// super.onReceivedSslError(view, handler, error) // super.onReceivedSslError(view, handler, error)
// handler?.proceed() Blog.LOGE(log= "onReceivedSslError >> ${error}")
// } handler?.proceed()
// override fun onReceivedHttpError( }
// view: WebView?, override fun onReceivedHttpError(
// request: WebResourceRequest?, view: WebView?,
// errorResponse: WebResourceResponse? request: WebResourceRequest?,
// ) { errorResponse: WebResourceResponse?
) {
Blog.LOGE(log= "onReceivedHttpError >> ${errorResponse}")
// super.onReceivedHttpError(view, request, errorResponse) // super.onReceivedHttpError(view, request, errorResponse)
// } }
override fun onPageFinished(view: WebView?, url: String?) { override fun onPageFinished(view: WebView?, url: String?) {
super.onPageFinished(view, url) super.onPageFinished(view, url)

View File

@ -4,7 +4,7 @@ import com.mime.dualscreenview.webcontents.BaseWebContents
object Booktoki : BaseWebContents() { object Booktoki : BaseWebContents() {
override var lastNumber : Int = 222 override var lastNumber : Int = 283
override fun getWebcontentsName(): String { override fun getWebcontentsName(): String {
return "Booktoki" return "Booktoki"

View File

@ -15,7 +15,7 @@
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" /> app:layout_constraintTop_toBottomOf="@id/textview_title" />
<com.mime.dualscreenview.view.PagedTextLayout <com.mime.dualscreenview.view.PagedTextLayout
@ -28,7 +28,7 @@
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" /> app:layout_constraintTop_toBottomOf="@id/textview_title" />
<ImageButton <ImageButton
android:id="@+id/btn_home" android:id="@+id/btn_home"
@ -38,14 +38,14 @@
android:scaleType="centerInside" android:scaleType="centerInside"
android:background="#8FFF" android:background="#8FFF"
android:src="@drawable/home" android:src="@drawable/home"
app:layout_constraintRight_toLeftOf="@id/textView" app:layout_constraintRight_toLeftOf="@id/textview_title"
app:layout_constraintHorizontal_chainStyle="spread_inside" app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
tools:ignore="MissingConstraints" /> tools:ignore="MissingConstraints" />
<TextView <TextView
android:id="@+id/textView" 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"
@ -65,7 +65,7 @@
android:background="#8FFF" android:background="#8FFF"
android:src="@drawable/invoice" android:src="@drawable/invoice"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toRightOf="@id/textView" app:layout_constraintLeft_toRightOf="@id/textview_title"
app:layout_constraintRight_toLeftOf="@+id/btn_rotate" app:layout_constraintRight_toLeftOf="@+id/btn_rotate"
app:layout_constraintHorizontal_chainStyle="spread_inside" app:layout_constraintHorizontal_chainStyle="spread_inside"
/> />

View File

@ -44,6 +44,12 @@
<com.mime.dualscreenview.view.StepsEditor <com.mime.dualscreenview.view.StepsEditor
android:id="@+id/page_padding" android:id="@+id/page_padding"
style="@style/StepsEditorStyle" /> style="@style/StepsEditorStyle" />
<com.mime.dualscreenview.view.ScopeEditor
android:id="@+id/page_typesface"
style="@style/StepsEditorStyle" />
<com.mime.dualscreenview.view.ScopeEditor
android:id="@+id/page_style"
style="@style/StepsEditorStyle" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>