.
This commit is contained in:
parent
271e0c66dc
commit
ae743bf784
@ -6,31 +6,36 @@ import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Color
|
||||
import android.hardware.display.DisplayManager
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Message
|
||||
import android.text.InputType
|
||||
import android.util.Log
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import android.view.View.*
|
||||
import android.webkit.WebView
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.EditText
|
||||
import android.widget.ImageButton
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.widget.AppCompatButton
|
||||
import com.google.gson.Gson
|
||||
import com.lge.display.DisplayManagerHelper
|
||||
import com.mime.dualscreenview.R
|
||||
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.dialog.StyleSelectInterface
|
||||
import com.mime.dualscreenview.dialog.Stylez
|
||||
import com.mime.dualscreenview.data.model.BookPageInfo
|
||||
import com.mime.dualscreenview.data.model.BookPageInfos
|
||||
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.query
|
||||
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.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
@ -234,7 +241,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
dialog, which ->
|
||||
var realm = openRealm()
|
||||
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)
|
||||
}
|
||||
}
|
||||
@ -276,19 +283,17 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
fun showStyleList() {
|
||||
var mStylez = Stylez(this@Intro)
|
||||
mStylez.styleSelectInterface = object : StyleSelectInterface {
|
||||
override fun onSelectStyle(bgColor: String, textColor: String) {
|
||||
paged_layer?.setColorStyle(arrayOf(textColor,bgColor))
|
||||
}
|
||||
}
|
||||
mStylez.show()
|
||||
}
|
||||
// fun showStyleList() {
|
||||
// var mStylez = Stylez(this@Intro)
|
||||
// mStylez.styleSelectInterface = object : StyleSelectInterface {
|
||||
// override fun onSelectStyle(bgColor: String, textColor: String) {
|
||||
// paged_layer?.setColorStyle(arrayOf(textColor,bgColor))
|
||||
// }
|
||||
// }
|
||||
// mStylez.show()
|
||||
// }
|
||||
|
||||
|
||||
override fun onDestroy() {
|
||||
@ -486,6 +491,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
Log.i(TAG,"showAlert >> " + alert)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun onLoadedContents(contents: String) {
|
||||
paged_layer.apply {
|
||||
if (contents != null) {
|
||||
@ -503,6 +509,11 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
||||
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
|
||||
|
||||
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();
|
||||
Blog.LOGI(TAG,"onFindTitle >> " + contents + " ::: ${testRegex.replace(contents,"")}")
|
||||
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_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_list).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_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_list).visibility = GONE
|
||||
findViewById<View>(R.id.btn_history).visibility = GONE
|
||||
|
||||
@ -1,7 +1,14 @@
|
||||
package com.mime.dualscreenview.activity
|
||||
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.annotation.RequiresApi
|
||||
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.model.ReaderConfig
|
||||
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.line_space
|
||||
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.text_size
|
||||
|
||||
@ -32,6 +41,7 @@ class Settings : Base() {
|
||||
realm.close()
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
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() {
|
||||
|
||||
@ -1,15 +1,39 @@
|
||||
package com.mime.dualscreenview.common
|
||||
|
||||
import com.mime.dualscreenview.R
|
||||
|
||||
val colorz = arrayOf<Array<String>>(
|
||||
arrayOf<String>("#E1F5FE", "#263238"),
|
||||
arrayOf<String>("#F0F4C3", "#37474F"),
|
||||
arrayOf<String>("#ECEFF1", "#455A64"),
|
||||
arrayOf<String>("#E0F7FA", "#263238"),
|
||||
arrayOf<String>("#F5F5F5", "#263238"),
|
||||
arrayOf<String>("#ECEFF1", "#263238"),
|
||||
arrayOf<String>("#F8BBD0", "#263238"),
|
||||
arrayOf<String>("#E6EE9C", "#455A64"),
|
||||
arrayOf<String>("#CFD8DC", "#455A64"),
|
||||
arrayOf<String>("#FFF59D", "#37474F")
|
||||
typealias PairArray<T> = Array<Pair<String,T>>
|
||||
val colorz : PairArray<Array<String>> = arrayOf<Pair<String,Array<String>>>(
|
||||
Pair("color set 01",arrayOf<String>("#E1F5FE", "#263238")),
|
||||
Pair("color set 02",arrayOf<String>("#F0F4C3", "#37474F")),
|
||||
Pair("color set 03",arrayOf<String>("#ECEFF1", "#455A64")),
|
||||
Pair("color set 04",arrayOf<String>("#E0F7FA", "#263238")),
|
||||
Pair("color set 05",arrayOf<String>("#F5F5F5", "#263238")),
|
||||
Pair("color set 06",arrayOf<String>("#ECEFF1", "#263238")),
|
||||
Pair("color set 07",arrayOf<String>("#F8BBD0", "#263238")),
|
||||
Pair("color set 08",arrayOf<String>("#E6EE9C", "#455A64")),
|
||||
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
|
||||
}
|
||||
@ -11,10 +11,10 @@ import kotlin.reflect.KClass
|
||||
|
||||
object HistoryManager {
|
||||
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)
|
||||
.schemaVersion(2)
|
||||
.schemaVersion(schemaVersion)
|
||||
.build())
|
||||
|
||||
fun save(lastInfo: LastInfo) {
|
||||
|
||||
@ -9,6 +9,7 @@ class ReaderConfig() : RealmObject {
|
||||
var textSize : Int? = 14
|
||||
var textColor : String? = "#FFFFFF"
|
||||
var bgColor : String? = "#000000"
|
||||
var style : Int? = 0
|
||||
var lineSpace : Int? = 1
|
||||
var letterSpace : Int? = 1
|
||||
var font : String? = ""
|
||||
|
||||
@ -1,99 +1,97 @@
|
||||
package com.mime.dualscreenview.dialog
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.Window
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mime.dualscreenview.R
|
||||
import com.mime.dualscreenview.common.colorz
|
||||
import kotlin.random.Random
|
||||
|
||||
interface StyleSelectInterface {
|
||||
fun onSelectStyle(bgColor : String, textColor : String)
|
||||
}
|
||||
class Stylez : Dialog {
|
||||
constructor(context: Context) : super(context) {initView(context)}
|
||||
constructor(context: Context, themeResId: Int) : super(context, themeResId) {initView(context)}
|
||||
constructor(
|
||||
context: Context,
|
||||
cancelable: Boolean,
|
||||
cancelListener: DialogInterface.OnCancelListener?
|
||||
) : super(context, cancelable, cancelListener) {initView(context)}
|
||||
|
||||
var styleSelectInterface : StyleSelectInterface? = null
|
||||
|
||||
fun initView(context: Context) {
|
||||
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setCancelable(true)
|
||||
setContentView(R.layout.dialog_stylesz)
|
||||
val recyclerView: RecyclerView = findViewById(R.id.stylez_recyclerview)
|
||||
val adapterRe = AdapterRe(context, colorz)
|
||||
recyclerView.adapter = adapterRe
|
||||
recyclerView.layoutManager =
|
||||
GridLayoutManager(context, 2, GridLayoutManager.VERTICAL, false)
|
||||
}
|
||||
|
||||
inner class AdapterRe(ctx: Context, myImageNameList: Array<Array<String>>) :
|
||||
RecyclerView.Adapter<StylezViewHolder>() {
|
||||
private val inflater: LayoutInflater
|
||||
private val myImageNameList: Array<Array<String>>
|
||||
private val ctx : Context
|
||||
init {
|
||||
inflater = LayoutInflater.from(ctx)
|
||||
this.ctx = ctx
|
||||
this.myImageNameList = myImageNameList
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder (
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): StylezViewHolder {
|
||||
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)
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inner class StylezViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
var textView: TextView
|
||||
var bg : View
|
||||
init {
|
||||
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))
|
||||
textView.setTextColor(Color.parseColor(textColor))
|
||||
textView.text = sampleText
|
||||
itemView?.setOnClickListener { v ->
|
||||
styleSelectInterface?.onSelectStyle(bgColor,textColor)
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//package com.mime.dualscreenview.dialog
|
||||
//
|
||||
//import android.app.Dialog
|
||||
//import android.content.Context
|
||||
//import android.content.DialogInterface
|
||||
//import android.graphics.Color
|
||||
//import android.os.Bundle
|
||||
//import android.view.LayoutInflater
|
||||
//import android.view.View
|
||||
//import android.view.ViewGroup
|
||||
//import android.view.Window
|
||||
//import android.widget.TextView
|
||||
//import androidx.recyclerview.widget.GridLayoutManager
|
||||
//import androidx.recyclerview.widget.RecyclerView
|
||||
//import com.mime.dualscreenview.R
|
||||
//import kotlin.random.Random
|
||||
//
|
||||
//interface StyleSelectInterface {
|
||||
// fun onSelectStyle(bgColor : String, textColor : String)
|
||||
//}
|
||||
//class Stylez : Dialog {
|
||||
// constructor(context: Context) : super(context) {initView(context)}
|
||||
// constructor(context: Context, themeResId: Int) : super(context, themeResId) {initView(context)}
|
||||
// constructor(
|
||||
// context: Context,
|
||||
// cancelable: Boolean,
|
||||
// cancelListener: DialogInterface.OnCancelListener?
|
||||
// ) : super(context, cancelable, cancelListener) {initView(context)}
|
||||
//
|
||||
// var styleSelectInterface : StyleSelectInterface? = null
|
||||
//
|
||||
// fun initView(context: Context) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// override fun onCreate(savedInstanceState: Bundle?) {
|
||||
// super.onCreate(savedInstanceState)
|
||||
// this.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
// setCancelable(true)
|
||||
// setContentView(R.layout.dialog_stylesz)
|
||||
// val recyclerView: RecyclerView = findViewById(R.id.stylez_recyclerview)
|
||||
// val adapterRe = AdapterRe(context, colorz)
|
||||
// recyclerView.adapter = adapterRe
|
||||
// recyclerView.layoutManager =
|
||||
// GridLayoutManager(context, 2, GridLayoutManager.VERTICAL, false)
|
||||
// }
|
||||
//
|
||||
// inner class AdapterRe(ctx: Context, myImageNameList: Array<Array<String>>) :
|
||||
// RecyclerView.Adapter<StylezViewHolder>() {
|
||||
// private val inflater: LayoutInflater
|
||||
// private val myImageNameList: Array<Array<String>>
|
||||
// private val ctx : Context
|
||||
// init {
|
||||
// inflater = LayoutInflater.from(ctx)
|
||||
// this.ctx = ctx
|
||||
// this.myImageNameList = myImageNameList
|
||||
// }
|
||||
//
|
||||
// override fun onCreateViewHolder (
|
||||
// parent: ViewGroup,
|
||||
// viewType: Int
|
||||
// ): StylezViewHolder {
|
||||
// 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)
|
||||
// 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
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// inner class StylezViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
// var textView: TextView
|
||||
// var bg : View
|
||||
// init {
|
||||
// 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))
|
||||
// textView.setTextColor(Color.parseColor(textColor))
|
||||
// textView.text = sampleText
|
||||
// itemView?.setOnClickListener { v ->
|
||||
// styleSelectInterface?.onSelectStyle(bgColor,textColor)
|
||||
// dismiss()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@ -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 = ">"
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -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() }
|
||||
}
|
||||
}
|
||||
@ -11,7 +11,7 @@ import java.lang.Exception
|
||||
|
||||
typealias ValueChange = (Int)->Unit
|
||||
|
||||
class StepsEditor : ConstraintLayout {
|
||||
class StepsEditor : SideButtonTextView {
|
||||
constructor(context: Context) : super(context)
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||
@ -27,33 +27,11 @@ class StepsEditor : ConstraintLayout {
|
||||
defStyleRes: Int
|
||||
) : 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 {
|
||||
inflate(context, R.layout.layout_steps_editor,this)
|
||||
btn_decrement.setOnClickListener { value = value.dec() }
|
||||
btn_increment.setOnClickListener { value = value.inc() }
|
||||
leftButtonTitle = "-"
|
||||
rightButtonTitle = "+"
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,10 @@ package com.mime.dualscreenview.webcontents
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.graphics.Bitmap
|
||||
import android.net.http.SslError
|
||||
import android.util.Log
|
||||
import android.webkit.*
|
||||
import com.mime.dualscreenview.common.Blog
|
||||
import com.mime.dualscreenview.data.model.LastInfo
|
||||
import com.mime.dualscreenview.webcontents.contentsinfo.DidFindContents
|
||||
|
||||
@ -119,21 +121,23 @@ open class BaseWebContentsViewer {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// override fun onReceivedSslError(
|
||||
// view: WebView?,
|
||||
// handler: SslErrorHandler?,
|
||||
// error: SslError?
|
||||
// ) {
|
||||
//// super.onReceivedSslError(view, handler, error)
|
||||
// handler?.proceed()
|
||||
// }
|
||||
// override fun onReceivedHttpError(
|
||||
// view: WebView?,
|
||||
// request: WebResourceRequest?,
|
||||
// errorResponse: WebResourceResponse?
|
||||
// ) {
|
||||
override fun onReceivedSslError(
|
||||
view: WebView?,
|
||||
handler: SslErrorHandler?,
|
||||
error: SslError?
|
||||
) {
|
||||
// super.onReceivedSslError(view, handler, error)
|
||||
Blog.LOGE(log= "onReceivedSslError >> ${error}")
|
||||
handler?.proceed()
|
||||
}
|
||||
override fun onReceivedHttpError(
|
||||
view: WebView?,
|
||||
request: WebResourceRequest?,
|
||||
errorResponse: WebResourceResponse?
|
||||
) {
|
||||
Blog.LOGE(log= "onReceivedHttpError >> ${errorResponse}")
|
||||
// super.onReceivedHttpError(view, request, errorResponse)
|
||||
// }
|
||||
}
|
||||
|
||||
override fun onPageFinished(view: WebView?, url: String?) {
|
||||
super.onPageFinished(view, url)
|
||||
|
||||
@ -4,7 +4,7 @@ import com.mime.dualscreenview.webcontents.BaseWebContents
|
||||
|
||||
object Booktoki : BaseWebContents() {
|
||||
|
||||
override var lastNumber : Int = 222
|
||||
override var lastNumber : Int = 283
|
||||
|
||||
override fun getWebcontentsName(): String {
|
||||
return "Booktoki"
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
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
|
||||
@ -28,7 +28,7 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/btn_setting"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView" />
|
||||
app:layout_constraintTop_toBottomOf="@id/textview_title" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn_home"
|
||||
@ -38,14 +38,14 @@
|
||||
android:scaleType="centerInside"
|
||||
android:background="#8FFF"
|
||||
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_constraintStart_toStartOf="parent"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:id="@+id/textview_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/main_top_height"
|
||||
android:text="@string/app_name"
|
||||
@ -65,7 +65,7 @@
|
||||
android:background="#8FFF"
|
||||
android:src="@drawable/invoice"
|
||||
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_constraintHorizontal_chainStyle="spread_inside"
|
||||
/>
|
||||
|
||||
@ -44,6 +44,12 @@
|
||||
<com.mime.dualscreenview.view.StepsEditor
|
||||
android:id="@+id/page_padding"
|
||||
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>
|
||||
</ScrollView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Loading…
x
Reference in New Issue
Block a user