설정 기능 추가중
This commit is contained in:
parent
2d00a605e0
commit
06e62b4a17
@ -2,6 +2,7 @@ plugins {
|
|||||||
id 'com.android.application'
|
id 'com.android.application'
|
||||||
id 'org.jetbrains.kotlin.android'
|
id 'org.jetbrains.kotlin.android'
|
||||||
id 'io.realm.kotlin'
|
id 'io.realm.kotlin'
|
||||||
|
id 'kotlin-android-extensions'
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|||||||
@ -28,13 +28,16 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:launchMode="singleInstance"
|
android:launchMode="singleInstance"
|
||||||
android:name=".activity.Main"
|
android:name=".activity.Main"
|
||||||
android:exported="false">
|
android:exported="false">
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:launchMode="singleInstance"
|
||||||
|
android:name=".activity.Settings"
|
||||||
|
android:exported="false"
|
||||||
|
/>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@ -1,6 +1,5 @@
|
|||||||
package com.mime.dualscreenview.activity
|
package com.mime.dualscreenview.activity
|
||||||
|
|
||||||
import android.content.res.Configuration
|
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.os.Message
|
import android.os.Message
|
||||||
@ -19,8 +18,9 @@ import android.view.KeyEvent.KEYCODE_VOLUME_UP
|
|||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.mime.dualscreenview.common.Blog
|
import com.mime.dualscreenview.common.Blog
|
||||||
import com.mime.dualscreenview.dto.HistoryItem
|
import com.mime.dualscreenview.data.HistoryManager
|
||||||
import com.mime.dualscreenview.dto.LastInfo
|
import com.mime.dualscreenview.data.model.HistoryItem
|
||||||
|
import com.mime.dualscreenview.data.model.LastInfo
|
||||||
import io.realm.kotlin.Realm
|
import io.realm.kotlin.Realm
|
||||||
import io.realm.kotlin.RealmConfiguration
|
import io.realm.kotlin.RealmConfiguration
|
||||||
import io.realm.kotlin.types.BaseRealmObject
|
import io.realm.kotlin.types.BaseRealmObject
|
||||||
@ -126,12 +126,6 @@ open class Base : AppCompatActivity() {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun openRealm() : Realm {
|
fun openRealm() : Realm = HistoryManager.openRealm()
|
||||||
val clazz : Set<KClass<out BaseRealmObject>> = setOf(LastInfo::class, HistoryItem::class)
|
|
||||||
val config = RealmConfiguration.Builder(clazz)
|
|
||||||
.schemaVersion(1)
|
|
||||||
.build()
|
|
||||||
return Realm.open(config)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -28,10 +28,11 @@ import com.mime.dualscreenview.R
|
|||||||
import com.mime.dualscreenview.common.Blog
|
import com.mime.dualscreenview.common.Blog
|
||||||
import com.mime.dualscreenview.dialog.StyleSelectInterface
|
import com.mime.dualscreenview.dialog.StyleSelectInterface
|
||||||
import com.mime.dualscreenview.dialog.Stylez
|
import com.mime.dualscreenview.dialog.Stylez
|
||||||
import com.mime.dualscreenview.dto.BookPageInfo
|
import com.mime.dualscreenview.data.model.BookPageInfo
|
||||||
import com.mime.dualscreenview.dto.BookPageInfos
|
import com.mime.dualscreenview.data.model.BookPageInfos
|
||||||
import com.mime.dualscreenview.dto.HistoryItem
|
import com.mime.dualscreenview.data.model.HistoryItem
|
||||||
import com.mime.dualscreenview.dto.LastInfo
|
import com.mime.dualscreenview.data.model.LastInfo
|
||||||
|
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
|
||||||
import com.mime.dualscreenview.view.TouchArea
|
import com.mime.dualscreenview.view.TouchArea
|
||||||
@ -39,13 +40,10 @@ import com.mime.dualscreenview.webcontents.BaseWebContentsViewer
|
|||||||
import com.mime.dualscreenview.webcontents.MainControllInterface
|
import com.mime.dualscreenview.webcontents.MainControllInterface
|
||||||
import com.mime.dualscreenview.webcontents.contentsinfo.Booktoki
|
import com.mime.dualscreenview.webcontents.contentsinfo.Booktoki
|
||||||
import com.mime.dualscreenview.webcontents.contentsinfo.GotoSomeWhere
|
import com.mime.dualscreenview.webcontents.contentsinfo.GotoSomeWhere
|
||||||
import io.realm.kotlin.Realm
|
|
||||||
import io.realm.kotlin.RealmConfiguration
|
|
||||||
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 java.lang.System.currentTimeMillis
|
import java.lang.System.currentTimeMillis
|
||||||
import java.net.URI
|
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
||||||
@ -115,7 +113,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
|||||||
switcvhOrient()
|
switcvhOrient()
|
||||||
}
|
}
|
||||||
findViewById<View>(R.id.btn_setting).setOnClickListener { v->
|
findViewById<View>(R.id.btn_setting).setOnClickListener { v->
|
||||||
showStyleList()
|
startActivity(Intent(this@Intro, Settings::class.java))
|
||||||
}
|
}
|
||||||
findViewById<View>(R.id.btn_history).setOnClickListener { v->
|
findViewById<View>(R.id.btn_history).setOnClickListener { v->
|
||||||
var realm = openRealm()
|
var realm = openRealm()
|
||||||
@ -126,20 +124,22 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
|||||||
}
|
}
|
||||||
findViewById<View>(R.id.btn_home).setOnClickListener { v->
|
findViewById<View>(R.id.btn_home).setOnClickListener { v->
|
||||||
pagedTextLayout?.visibility = GONE
|
pagedTextLayout?.visibility = GONE
|
||||||
mBaseWebContentsViewer.loadContents(Booktoki())
|
mBaseWebContentsViewer.loadContents(Booktoki)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadLastInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun reloadLastInfo() {
|
fun loadLastInfo(){
|
||||||
val realm = openRealm()
|
val realm = openRealm()
|
||||||
try { lastInfo = realm?.query<LastInfo>()?.find()?.last()?.copyFromRealm() } catch (e : Exception) { }
|
try { lastInfo = realm?.query<LastInfo>()?.find()?.last()?.copyFromRealm() } catch (e : Exception) { }
|
||||||
|
realm.close()
|
||||||
|
}
|
||||||
|
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) {
|
||||||
findViewById<View>(R.id.btn_rotate).performClick()
|
findViewById<View>(R.id.btn_rotate).performClick()
|
||||||
}
|
}
|
||||||
realm.close()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun reloadTo(lastInfo: LastInfo?) {
|
fun reloadTo(lastInfo: LastInfo?) {
|
||||||
@ -147,12 +147,13 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
|||||||
if (lastInfo != null) {
|
if (lastInfo != null) {
|
||||||
mBaseWebContentsViewer.loadLastInfo(lastInfo!!)
|
mBaseWebContentsViewer.loadLastInfo(lastInfo!!)
|
||||||
} else {
|
} else {
|
||||||
mBaseWebContentsViewer.loadContents(Booktoki())
|
mBaseWebContentsViewer.loadContents(Booktoki)
|
||||||
}
|
}
|
||||||
},200L)
|
},200L)
|
||||||
}
|
}
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
reloadLastInfo()
|
reloadLastInfo()
|
||||||
reloadTo(lastInfo)
|
reloadTo(lastInfo)
|
||||||
}
|
}
|
||||||
@ -221,40 +222,11 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun showList(infos: BookPageInfos) {
|
fun showList(infos: BookPageInfos) {
|
||||||
val builderSingle: AlertDialog.Builder = AlertDialog.Builder(this@Intro)
|
DefaultList.showDefaultList(this@Intro,"현제는 ${currentTitle} - ${currentChapter} -> 다른화를 골라",infos.getTitleArray(),currentChapter, { position ->
|
||||||
builderSingle.setTitle("${currentTitle} : ${currentChapter} -> Select One ")
|
return@showDefaultList infos.list?.get(position)?.title ?: ""
|
||||||
val arrayAdapter =
|
},{position ->
|
||||||
ArrayAdapter<String>(this@Intro, android.R.layout.select_dialog_singlechoice)
|
infos.list?.get(position)?.let{moveTo(it)}
|
||||||
arrayAdapter.addAll(infos.getTitleArray())
|
|
||||||
|
|
||||||
|
|
||||||
builderSingle.setNegativeButton("cancel",
|
|
||||||
DialogInterface.OnClickListener { dialog, which -> dialog.dismiss() })
|
|
||||||
|
|
||||||
builderSingle.setAdapter(arrayAdapter,
|
|
||||||
DialogInterface.OnClickListener { dialog, which ->
|
|
||||||
val strName = arrayAdapter.getItem(which)
|
|
||||||
val item = infos.list?.get(which)
|
|
||||||
val builderInner: AlertDialog.Builder = AlertDialog.Builder(this@Intro)
|
|
||||||
builderInner.setMessage(strName)
|
|
||||||
builderInner.setTitle("Your Selected Item is")
|
|
||||||
builderInner.setPositiveButton("Ok",
|
|
||||||
DialogInterface.OnClickListener { dialog, which ->
|
|
||||||
// mBaseWebContentsViewer?.webview?.loadUrl()
|
|
||||||
moveTo(item)
|
|
||||||
dialog.dismiss()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
builderInner.show()
|
|
||||||
})
|
})
|
||||||
var ddddd= builderSingle.create()
|
|
||||||
ddddd.setOnShowListener { d->
|
|
||||||
(d as? AlertDialog)?.let{
|
|
||||||
it.listView?.setSelection(currentChapter)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ddddd.show()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun moveTo(item: BookPageInfo?) {
|
private fun moveTo(item: BookPageInfo?) {
|
||||||
@ -422,6 +394,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
|
|||||||
onNextClickAction?.let { it() }
|
onNextClickAction?.let { it() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var onPrevClickAction: GotoSomeWhere? = null
|
var onPrevClickAction: GotoSomeWhere? = null
|
||||||
override fun showPrevBtn(find : Boolean, onClickAction: GotoSomeWhere) {
|
override fun showPrevBtn(find : Boolean, onClickAction: GotoSomeWhere) {
|
||||||
onPrevClickAction = onClickAction
|
onPrevClickAction = onClickAction
|
||||||
|
|||||||
@ -0,0 +1,36 @@
|
|||||||
|
package com.mime.dualscreenview.activity
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import com.mime.dualscreenview.R
|
||||||
|
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.preview
|
||||||
|
import kotlinx.android.synthetic.main.settings.text_size
|
||||||
|
|
||||||
|
class Settings : Base() {
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.settings)
|
||||||
|
text_size.displayFormat = "글자 크기 : %d"
|
||||||
|
text_size.mValueChange = { preview.textSize = it.toFloat() }
|
||||||
|
text_size.value = 14
|
||||||
|
page_padding.displayFormat = "페이지 여백 : %d"
|
||||||
|
page_padding.mValueChange = { preview.setPadding(it,it,it,it) }
|
||||||
|
page_padding.value = 5
|
||||||
|
letter_space.displayFormat = "자간 : %d"
|
||||||
|
letter_space.mValueChange = { preview.letterSpacing = it.times(0.01).toFloat() }
|
||||||
|
letter_space.value = 1
|
||||||
|
line_space.displayFormat = "행간 : %d"
|
||||||
|
line_space.mValueChange = { preview.setLineSpacing(1f, 1f.plus(it.times(0.01f))) }
|
||||||
|
line_space.value = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
package com.mime.dualscreenview.data
|
||||||
|
|
||||||
|
import com.mime.dualscreenview.data.model.HistoryItem
|
||||||
|
import com.mime.dualscreenview.data.model.LastInfo
|
||||||
|
import com.mime.dualscreenview.data.model.ReaderConfig
|
||||||
|
import io.realm.kotlin.Realm
|
||||||
|
import io.realm.kotlin.RealmConfiguration
|
||||||
|
import io.realm.kotlin.UpdatePolicy
|
||||||
|
import io.realm.kotlin.types.BaseRealmObject
|
||||||
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
|
object HistoryManager {
|
||||||
|
val clazz : Set<KClass<out BaseRealmObject>> = setOf(LastInfo::class, HistoryItem::class, ReaderConfig::class)
|
||||||
|
val schemaVersion : Long = 1
|
||||||
|
|
||||||
|
fun openRealm() : Realm = Realm.open(RealmConfiguration.Builder(clazz)
|
||||||
|
.schemaVersion(1)
|
||||||
|
.build())
|
||||||
|
|
||||||
|
fun save(lastInfo: LastInfo) {
|
||||||
|
openRealm()?.apply{
|
||||||
|
this.writeBlocking {
|
||||||
|
copyToRealm(lastInfo, UpdatePolicy.ALL)
|
||||||
|
}
|
||||||
|
}?.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun save(historyItem: HistoryItem) {
|
||||||
|
openRealm()?.apply{
|
||||||
|
this.writeBlocking {
|
||||||
|
copyToRealm(historyItem, UpdatePolicy.ALL)
|
||||||
|
}
|
||||||
|
}?.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun requestLastInfo(callback : (LastInfo)->Unit) {
|
||||||
|
openRealm()?.apply{
|
||||||
|
|
||||||
|
}?.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.mime.dualscreenview.dto
|
package com.mime.dualscreenview.data.model
|
||||||
|
|
||||||
|
|
||||||
class BookPageInfos {
|
class BookPageInfos {
|
||||||
@ -1,9 +1,8 @@
|
|||||||
package com.mime.dualscreenview.dto
|
package com.mime.dualscreenview.data.model
|
||||||
|
|
||||||
import android.content.pm.ActivityInfo
|
import android.content.pm.ActivityInfo
|
||||||
import io.realm.kotlin.types.RealmObject
|
import io.realm.kotlin.types.RealmObject
|
||||||
import io.realm.kotlin.types.annotations.PrimaryKey
|
import io.realm.kotlin.types.annotations.PrimaryKey
|
||||||
import org.mongodb.kbson.ObjectId
|
|
||||||
|
|
||||||
|
|
||||||
class LastInfo() : RealmObject {
|
class LastInfo() : RealmObject {
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.mime.dualscreenview.data.model
|
||||||
|
|
||||||
|
import io.realm.kotlin.types.RealmObject
|
||||||
|
import io.realm.kotlin.types.annotations.PrimaryKey
|
||||||
|
|
||||||
|
class ReaderConfig() : RealmObject {
|
||||||
|
@PrimaryKey
|
||||||
|
var id : String? = ""
|
||||||
|
var textSize : Int? = 14
|
||||||
|
var textColor : String? = "#FFFFFF"
|
||||||
|
var bgColor : String? = "#000000"
|
||||||
|
var lineSpace : Int? = 0
|
||||||
|
var letterSpace : Int? = 0
|
||||||
|
var font : String? = ""
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
package com.mime.dualscreenview.dialog
|
||||||
|
|
||||||
|
import android.R
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.DialogInterface
|
||||||
|
import android.widget.ArrayAdapter
|
||||||
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
|
||||||
|
object DefaultList {
|
||||||
|
fun showDefaultList(context: Context,title : String, items : Collection<String>, firstPosition : Int, choosedTitle : (Int)->String, chooedPositive : (Int)->Unit) {
|
||||||
|
val builderSingle: AlertDialog.Builder = AlertDialog.Builder(context)
|
||||||
|
builderSingle.setTitle(title)
|
||||||
|
val arrayAdapter =
|
||||||
|
ArrayAdapter<String>(context, R.layout.select_dialog_singlechoice)
|
||||||
|
arrayAdapter.addAll(items)
|
||||||
|
builderSingle.setNegativeButton("닫기",
|
||||||
|
DialogInterface.OnClickListener { dialog, which -> dialog.dismiss() })
|
||||||
|
|
||||||
|
builderSingle.setAdapter(arrayAdapter,
|
||||||
|
DialogInterface.OnClickListener { dialog, position ->
|
||||||
|
val strName = arrayAdapter.getItem(position)
|
||||||
|
val builderInner: AlertDialog.Builder = AlertDialog.Builder(context)
|
||||||
|
builderInner.setMessage(strName)
|
||||||
|
builderInner.setTitle(choosedTitle.invoke(position))
|
||||||
|
builderInner.setPositiveButton("이동"){ dialog, which ->
|
||||||
|
chooedPositive.invoke(position)
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
builderInner.show().apply {
|
||||||
|
DialogManager.add(this)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
builderSingle.create()?.apply{
|
||||||
|
setOnShowListener { d->
|
||||||
|
(d as? AlertDialog)?.let{
|
||||||
|
it.listView?.setSelection(firstPosition)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DialogManager.add(this)
|
||||||
|
}?.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.mime.dualscreenview.dialog
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import androidx.activity.ComponentDialog
|
||||||
|
import java.lang.Exception
|
||||||
|
|
||||||
|
object DialogManager {
|
||||||
|
val dialogs = arrayListOf<ComponentDialog>()
|
||||||
|
fun add(item : ComponentDialog) = dialogs.add(item)
|
||||||
|
fun closeAll() {
|
||||||
|
for (dialog in dialogs) {
|
||||||
|
try {
|
||||||
|
dialog?.dismiss()
|
||||||
|
} catch(e : Exception) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
package com.mime.dualscreenview.view
|
||||||
|
|
||||||
|
interface PagedTextGenerateInterface {
|
||||||
|
fun completePagination(pageList: ArrayList<CharSequence>)
|
||||||
|
}
|
||||||
@ -63,11 +63,12 @@ class PagedTextLayout : ConstraintLayout , PagedTextGenerateInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onSingleTap(touchArea: TouchArea) {
|
override fun onSingleTap(touchArea: TouchArea) {
|
||||||
var isCenterTouch = TouchArea.Center.equals(touchArea)
|
if(TouchArea.Center.equals(touchArea)) {
|
||||||
hanler.removeCallbacks(touchTimeover)
|
hanler.removeCallbacks(touchTimeover)
|
||||||
mPagedTextViewInterface?.onTouch(touchArea)
|
mPagedTextViewInterface?.onTouch(touchArea)
|
||||||
if(isCenterTouch) {
|
|
||||||
hanler?.postDelayed(touchTimeover, 3000L)
|
hanler?.postDelayed(touchTimeover, 3000L)
|
||||||
|
} else {
|
||||||
|
mPagedTextViewInterface?.onTouch(touchArea)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -12,17 +12,6 @@ import com.mime.dualscreenview.common.Blog
|
|||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
|
|
||||||
interface PagedTextViewInterface {
|
|
||||||
fun onTouch(touchArea: TouchArea)
|
|
||||||
fun onTimeoverTouch()
|
|
||||||
fun onSwipeLeft()
|
|
||||||
fun onSwipeRight()
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PagedTextGenerateInterface {
|
|
||||||
fun completePagination(pageList: ArrayList<CharSequence>)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class PagedTextView : AppCompatTextView {
|
class PagedTextView : AppCompatTextView {
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,8 @@
|
|||||||
|
package com.mime.dualscreenview.view
|
||||||
|
|
||||||
|
interface PagedTextViewInterface {
|
||||||
|
fun onTouch(touchArea: TouchArea)
|
||||||
|
fun onTimeoverTouch()
|
||||||
|
fun onSwipeLeft()
|
||||||
|
fun onSwipeRight()
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
typealias ValueChange = (Int)->Unit
|
||||||
|
|
||||||
|
class StepsEditor : 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 value : Int = 14
|
||||||
|
set(newValue) {
|
||||||
|
text_value.text = displayFormat.format(newValue)
|
||||||
|
mValueChange?.invoke(newValue)
|
||||||
|
field = newValue
|
||||||
|
}
|
||||||
|
var displayFormat = "글자 크기 : %d"
|
||||||
|
set(newValue) {
|
||||||
|
try {
|
||||||
|
text_value.text = displayFormat.format(value)
|
||||||
|
} catch (e : Exception) {
|
||||||
|
|
||||||
|
}
|
||||||
|
field = newValue
|
||||||
|
}
|
||||||
|
|
||||||
|
var mValueChange : ValueChange? = null
|
||||||
|
set(newValue) {
|
||||||
|
if (newValue != null) {
|
||||||
|
newValue(value)
|
||||||
|
}
|
||||||
|
field = newValue
|
||||||
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
inflate(context, R.layout.layout_steps_editor,this)
|
||||||
|
btn_decrement.setOnClickListener { value = value.dec() }
|
||||||
|
btn_increment.setOnClickListener { value = value.inc() }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,11 +2,9 @@ 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 android.widget.Toast
|
import com.mime.dualscreenview.data.model.LastInfo
|
||||||
import com.mime.dualscreenview.dto.LastInfo
|
|
||||||
import com.mime.dualscreenview.webcontents.contentsinfo.DidFindContents
|
import com.mime.dualscreenview.webcontents.contentsinfo.DidFindContents
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package com.mime.dualscreenview.webcontents
|
package com.mime.dualscreenview.webcontents
|
||||||
|
|
||||||
import com.mime.dualscreenview.dto.LastInfo
|
import com.mime.dualscreenview.data.model.LastInfo
|
||||||
import com.mime.dualscreenview.webcontents.contentsinfo.GotoSomeWhere
|
import com.mime.dualscreenview.webcontents.contentsinfo.GotoSomeWhere
|
||||||
|
|
||||||
interface MainControllInterface {
|
interface MainControllInterface {
|
||||||
|
|||||||
@ -3,10 +3,10 @@ package com.mime.dualscreenview.webcontents
|
|||||||
import com.mime.dualscreenview.webcontents.contentsinfo.Booktoki
|
import com.mime.dualscreenview.webcontents.contentsinfo.Booktoki
|
||||||
|
|
||||||
object WebContentsManger {
|
object WebContentsManger {
|
||||||
val allContentsList : ArrayList<BaseWebContents> = arrayListOf(Booktoki())
|
val allContentsList : ArrayList<BaseWebContents> = arrayListOf(Booktoki)
|
||||||
|
|
||||||
fun getBaseWebContentsBy(name : String) : BaseWebContents {
|
fun getBaseWebContentsBy(name : String) : BaseWebContents {
|
||||||
var correctContents : BaseWebContents = Booktoki()
|
var correctContents : BaseWebContents = Booktoki
|
||||||
for (contents in allContentsList) {
|
for (contents in allContentsList) {
|
||||||
if(name.equals(contents.getWebcontentsName())) {
|
if(name.equals(contents.getWebcontentsName())) {
|
||||||
correctContents = contents
|
correctContents = contents
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package com.mime.dualscreenview.webcontents.contentsinfo
|
|||||||
|
|
||||||
import com.mime.dualscreenview.webcontents.BaseWebContents
|
import com.mime.dualscreenview.webcontents.BaseWebContents
|
||||||
|
|
||||||
class Booktoki : BaseWebContents() {
|
object Booktoki : BaseWebContents() {
|
||||||
|
|
||||||
override var lastNumber : Int = 222
|
override var lastNumber : Int = 222
|
||||||
|
|
||||||
|
|||||||
BIN
app/src/main/res/font/jsarirang_hon.otf
Normal file
BIN
app/src/main/res/font/jsarirang_hon.otf
Normal file
Binary file not shown.
BIN
app/src/main/res/font/jsarirang_ppuri.otf
Normal file
BIN
app/src/main/res/font/jsarirang_ppuri.otf
Normal file
Binary file not shown.
BIN
app/src/main/res/font/jsdongkang_regular.otf
Normal file
BIN
app/src/main/res/font/jsdongkang_regular.otf
Normal file
Binary file not shown.
BIN
app/src/main/res/font/kcc_sonkeechung.otf
Normal file
BIN
app/src/main/res/font/kcc_sonkeechung.otf
Normal file
Binary file not shown.
BIN
app/src/main/res/font/kyobo_handwriting_2021sjy.otf
Normal file
BIN
app/src/main/res/font/kyobo_handwriting_2021sjy.otf
Normal file
Binary file not shown.
BIN
app/src/main/res/font/taebaek_milkyway.otf
Normal file
BIN
app/src/main/res/font/taebaek_milkyway.otf
Normal file
Binary file not shown.
@ -2,12 +2,13 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="150dp"
|
android:layout_width="150dp"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="2.5dp"
|
||||||
android:id="@+id/bg_sample"
|
android:id="@+id/bg_sample"
|
||||||
android:layout_height="140dp">
|
android:layout_height="140dp">
|
||||||
<TextView
|
<TextView
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text=""
|
android:text=""
|
||||||
|
android:textAlignment="center"
|
||||||
android:id="@+id/textview_sample"
|
android:id="@+id/textview_sample"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"/>
|
android:layout_height="match_parent"/>
|
||||||
|
|||||||
24
app/src/main/res/layout/item_setting_title.xml
Normal file
24
app/src/main/res/layout/item_setting_title.xml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/setting_title"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Setting"
|
||||||
|
android:fontFamily="@font/jsdongkang_regular"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="@dimen/setting_item_height"/>
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/custom_style"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/setting_title"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/setting_title"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
47
app/src/main/res/layout/layout_steps_editor.xml
Normal file
47
app/src/main/res/layout/layout_steps_editor.xml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<androidx.appcompat.widget.AppCompatButton
|
||||||
|
android:id="@+id/btn_decrement"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="-"
|
||||||
|
android:padding="0dp"
|
||||||
|
android:textSize="20dp"
|
||||||
|
android:fontFamily="@font/jsdongkang_regular"
|
||||||
|
android:background="@color/button_color"
|
||||||
|
android:backgroundTint="@color/button_color_tint"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/text_value"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/text_value"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="14dp"
|
||||||
|
android:fontFamily="@font/jsdongkang_regular"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/btn_increment"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/btn_decrement" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatButton
|
||||||
|
android:id="@+id/btn_increment"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/button_color"
|
||||||
|
android:text="+"
|
||||||
|
android:padding="0dp"
|
||||||
|
android:textSize="20dp"
|
||||||
|
android:fontFamily="@font/jsdongkang_regular"
|
||||||
|
android:backgroundTint="@color/button_color_tint"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/text_value" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@ -24,9 +24,10 @@
|
|||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toLeftOf="@id/sencond_view"
|
app:layout_constraintRight_toLeftOf="@id/sencond_view"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
style="@style/sss"
|
||||||
android:layout_height="match_parent"/>
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
<TextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:id="@+id/first_view"
|
android:id="@+id/first_view"
|
||||||
android:padding="@dimen/textview_padding"
|
android:padding="@dimen/textview_padding"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
@ -34,9 +35,10 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintRight_toLeftOf="@id/sencond_view"
|
app:layout_constraintRight_toLeftOf="@id/sencond_view"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
style="@style/sss"
|
||||||
android:layout_height="match_parent"/>
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
<TextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:padding="@dimen/textview_padding"
|
android:padding="@dimen/textview_padding"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
@ -45,5 +47,6 @@
|
|||||||
app:layout_constraintLeft_toLeftOf="@id/center_guide"
|
app:layout_constraintLeft_toLeftOf="@id/center_guide"
|
||||||
android:id="@+id/sencond_view"
|
android:id="@+id/sencond_view"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
style="@style/sss"
|
||||||
android:layout_height="match_parent"/>
|
android:layout_height="match_parent"/>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
49
app/src/main/res/layout/settings.xml
Normal file
49
app/src/main/res/layout/settings.xml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<androidx.constraintlayout.widget.Guideline
|
||||||
|
android:id="@+id/vertical_guide"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintGuide_percent="0.5"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
android:id="@+id/preview"
|
||||||
|
android:text="@string/preview_text"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"/>
|
||||||
|
<ScrollView
|
||||||
|
android:id="@+id/config_setting"
|
||||||
|
android:background="#99444444"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/vertical_guide"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp">
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<include layout="@layout/item_setting_title"/>
|
||||||
|
<com.mime.dualscreenview.view.StepsEditor
|
||||||
|
android:id="@+id/text_size"
|
||||||
|
style="@style/StepsEditorStyle" />
|
||||||
|
<com.mime.dualscreenview.view.StepsEditor
|
||||||
|
android:id="@+id/letter_space"
|
||||||
|
style="@style/StepsEditorStyle" />
|
||||||
|
<com.mime.dualscreenview.view.StepsEditor
|
||||||
|
android:id="@+id/line_space"
|
||||||
|
style="@style/StepsEditorStyle" />
|
||||||
|
<com.mime.dualscreenview.view.StepsEditor
|
||||||
|
android:id="@+id/page_padding"
|
||||||
|
style="@style/StepsEditorStyle" />
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@ -7,4 +7,6 @@
|
|||||||
<color name="teal_700">#FF018786</color>
|
<color name="teal_700">#FF018786</color>
|
||||||
<color name="black">#FF000000</color>
|
<color name="black">#FF000000</color>
|
||||||
<color name="white">#FFFFFFFF</color>
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
<color name="button_color">#994CAF50</color>
|
||||||
|
<color name="button_color_tint">#99007ACC</color>
|
||||||
</resources>
|
</resources>
|
||||||
@ -2,4 +2,5 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<dimen name="main_top_height">35dp</dimen>
|
<dimen name="main_top_height">35dp</dimen>
|
||||||
<dimen name="textview_padding">15dp</dimen>
|
<dimen name="textview_padding">15dp</dimen>
|
||||||
|
<dimen name="setting_item_height">45dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
@ -2,6 +2,7 @@
|
|||||||
<string name="app_name">DualScreenView</string>
|
<string name="app_name">DualScreenView</string>
|
||||||
<string name="display_the_second_screen">화면 옮 기 기</string>
|
<string name="display_the_second_screen">화면 옮 기 기</string>
|
||||||
<string name="main_desc">it\'s 두번째화면</string>
|
<string name="main_desc">it\'s 두번째화면</string>
|
||||||
|
<string name="preview_text"><![CDATA[여섯글자마다 방점을찍어놔가사관찰하다 반쯤놓치거나해석잘안되면 몇번돌리든가이건이를테면 덤비는리듬과손묶인채붙는 일종의노름판\n신도구제불능 내가물오른밤감방에날가둬 내가패를까도가난한니네가 판돈잃지않게나하고니네가 의견일치한게아마처음일걸 그마저운일걸\n존나좋음이퀄 내중저음일걸이배열어쩌면 너에대한배려너에겐어쩌면 언어적배리어그럼넌글렀어 지망생여기에잠들다글로써 훗날니묘비에\n\nFor sale my rhymes never usedFor sale my rhymes never used판매자바로너 니가씨발오너For sale my rhymes never used\n\n노예처럼일해서왕처럼지배성탄처럼지내설탕뿌려위에성공을말했기에난그길위에선딱그어이젠자봐주의깊게\n멈칫할시간도없는듯써내려활자로활짝갠곳에돈비내려초라한핀조명과낮은무대위목표를조준하기에충분했지\n시인의신이될준비는치밀해흘러군침이계속이기기위해처음시작했던이유따윈잊어\n맨발맨손으로역사들을빚어미안해난비션갖고와내기적자음모음이어리듬위에띄어금은보화이쁜걸로손에끼워\n\nUh she suckin\' my soul likeDe La to the SoulI shout out to the RhondaBut before I\'m sober\n변태는 변태인데 underground 모범생맨날 난 오덕 돼 활자에 꼬여내 팔자도 고쳐낼 하나의 초월체를만들려 고쳐댄 rhyme들만 몇 truck 돼\n그러다 깨어나 여기에빼어난 묘기에 없네 기본기내 눈엔 수명이 대본처럼 읽히네뭐처럼 비치네 뭐처럼 비치네\nFuck all of ya list manIf it ain\'t Forbes list mayneYour wristwatch cheaper thanMy profile picture damn\nPicture the future and믿어 like it\'s happendBig ass house foreign cars have several\n미녀 fine ass apple hip 내 옆에 같이 태우고Top of the top으로 가 죽어야 들어 잠은넌 안 죽었다는 척갖은 폼 잡으면 뭐하냐\n좆밥들 또 반년만 가면 쏙다 들어가는 거 다 보여내 눈엔 너가 금방 죽어다음 무덤 안 들어갈 주검한 우물 파는 넌 밟고서땅을 쳐봐 내 발자국을\n]]></string>
|
||||||
|
|
||||||
<string-array name="sample_textz">
|
<string-array name="sample_textz">
|
||||||
<item>여섯글자마다 방점을찍어놔
|
<item>여섯글자마다 방점을찍어놔
|
||||||
|
|||||||
12
app/src/main/res/values/style.xml
Normal file
12
app/src/main/res/values/style.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<style name="sss">
|
||||||
|
<item name="android:fontFamily">@font/kcc_sonkeechung</item>
|
||||||
|
<item name="android:textSize">14dp</item>
|
||||||
|
<item name="android:textAlignment">textStart</item>
|
||||||
|
</style>
|
||||||
|
<style name="StepsEditorStyle">
|
||||||
|
<item name="android:layout_width">match_parent</item>>
|
||||||
|
<item name="android:layout_height">@dimen/setting_item_height</item>>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
Loading…
x
Reference in New Issue
Block a user