This commit is contained in:
2023-03-27 18:43:46 +09:00
parent 389182c38a
commit 2d00a605e0
18 changed files with 719 additions and 332 deletions
@@ -1,5 +1,6 @@
package com.mime.dualscreenview.activity
import android.content.res.Configuration
import android.os.Handler
import android.os.Looper
import android.os.Message
@@ -18,6 +19,12 @@ import android.view.KeyEvent.KEYCODE_VOLUME_UP
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.mime.dualscreenview.common.Blog
import com.mime.dualscreenview.dto.HistoryItem
import com.mime.dualscreenview.dto.LastInfo
import io.realm.kotlin.Realm
import io.realm.kotlin.RealmConfiguration
import io.realm.kotlin.types.BaseRealmObject
import kotlin.reflect.KClass
open class Base : AppCompatActivity() {
@@ -26,18 +33,6 @@ open class Base : AppCompatActivity() {
override fun handleMessage(msg: Message) {
super.handleMessage(msg)
}
//
// override fun dispatchMessage(msg: Message) {
// super.dispatchMessage(msg)
// }
//
// override fun getMessageName(message: Message): String {
// return super.getMessageName(message)
// }
//
// override fun sendMessageAtTime(msg: Message, uptimeMillis: Long): Boolean {
// return super.sendMessageAtTime(msg, uptimeMillis)
// }
}
val baseHandler = BaseHandler()
var didBackPress = false
@@ -131,5 +126,12 @@ open class Base : AppCompatActivity() {
return false
}
fun openRealm() : Realm {
val clazz : Set<KClass<out BaseRealmObject>> = setOf(LastInfo::class, HistoryItem::class)
val config = RealmConfiguration.Builder(clazz)
.schemaVersion(1)
.build()
return Realm.open(config)
}
}
@@ -6,8 +6,8 @@ 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.util.Log
@@ -16,21 +16,21 @@ import android.view.View
import android.view.View.*
import android.webkit.WebView
import android.widget.ArrayAdapter
import android.widget.Button
import android.widget.ImageButton
import android.widget.LinearLayout
import android.widget.ProgressBar
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.AppCompatButton
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.updateLayoutParams
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.dialog.StyleSelectInterface
import com.mime.dualscreenview.dialog.Stylez
import com.mime.dualscreenview.dto.BookPageInfo
import com.mime.dualscreenview.dto.BookPageInfos
import com.mime.dualscreenview.dto.HistoryItem
import com.mime.dualscreenview.dto.LastInfo
import com.mime.dualscreenview.view.PagedTextLayout
import com.mime.dualscreenview.view.PagedTextViewInterface
@@ -41,8 +41,13 @@ import com.mime.dualscreenview.webcontents.contentsinfo.Booktoki
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.ext.copyFromRealm
import io.realm.kotlin.ext.query
import java.lang.System.currentTimeMillis
import java.net.URI
import java.text.SimpleDateFormat
import java.util.Date
class Intro : Base() , MainControllInterface, PagedTextViewInterface {
@@ -60,18 +65,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
private lateinit var mBaseWebContentsViewer : BaseWebContentsViewer
var lastInfo : LastInfo? = null
val colors = 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")
)
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
@@ -80,10 +74,9 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Blog.LOGD(log= "onCreate ${this::class.java.name} >> savedInstanceState ${savedInstanceState}")
setContentView(R.layout.intro)
mBaseWebContentsViewer = BaseWebContentsViewer(findViewById<WebView>(R.id.menu_web),this)
try {
// Try to construct the DisplayMangerHelper.
@@ -106,8 +99,15 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
findViewById<ImageButton>(R.id.btn_list).setOnClickListener { v ->
mBaseWebContentsViewer?.findListItem {result ->
var infos = Gson().fromJson(result, BookPageInfos::class.java)
showList(infos)
if (result != null && "null".equals(result) == false && result?.length ?: 0 > 10) {
try {
Gson().fromJson(result, BookPageInfos::class.java)?.let{
showList(it)
}
} catch (e : Exception) {
}
}
}
}
@@ -117,32 +117,46 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
findViewById<View>(R.id.btn_setting).setOnClickListener { v->
showStyleList()
}
findViewById<View>(R.id.btn_history).setOnClickListener { v->
var realm = openRealm()
realm.query<HistoryItem>()?.find()?.let {
showHistory(realm.copyFromRealm(it))
}
realm.close()
}
findViewById<View>(R.id.btn_home).setOnClickListener { v->
pagedTextLayout?.visibility = GONE
mBaseWebContentsViewer.loadContents(Booktoki())
}
val config = RealmConfiguration.Builder(setOf(LastInfo::class)).schemaVersion(1)
.build()
val realm = Realm.open(config)
}
try {
lastInfo = realm?.query<LastInfo>()?.find()?.last()?.copyFromRealm()
} catch (e : Exception) {
fun reloadLastInfo() {
val realm = openRealm()
try { lastInfo = realm?.query<LastInfo>()?.find()?.last()?.copyFromRealm() } catch (e : Exception) { }
val configuration: Configuration = getResources().getConfiguration()
if(lastInfo != null && lastInfo?.displayOrientation != configuration.orientation) {
findViewById<View>(R.id.btn_rotate).performClick()
}
if (lastInfo != null) {
setRequestedOrientation(lastInfo!!.displayOrientation);
mBaseWebContentsViewer.loadLastInfo(lastInfo!!)
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
mBaseWebContentsViewer.loadContents(Booktoki())
}
Blog.LOGD(log ="Successfully opened realm: ${realm.configuration.name}")
realm.close()
}
fun reloadTo(lastInfo: LastInfo?) {
findViewById<WebView>(R.id.menu_web)?.postDelayed({
if (lastInfo != null) {
mBaseWebContentsViewer.loadLastInfo(lastInfo!!)
} else {
mBaseWebContentsViewer.loadContents(Booktoki())
}
},200L)
}
override fun onResume() {
super.onResume()
reloadLastInfo()
reloadTo(lastInfo)
}
fun switcvhOrient(){
val windowManager = getSystemService(WINDOW_SERVICE)
val configuration: Configuration = getResources().getConfiguration()
setRequestedOrientation(
if(configuration.orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) { ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE }
@@ -150,9 +164,65 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
)
}
fun showHistory(infos: List<HistoryItem>) {
val builderSingle: AlertDialog.Builder = AlertDialog.Builder(this@Intro)
builderSingle.setTitle("${currentTitle} : ${currentChapter} -> Select One ")
val arrayAdapter =
ArrayAdapter<String>(this@Intro, android.R.layout.select_dialog_singlechoice)
for (item in infos) {
arrayAdapter.addAll(item.title)
}
builderSingle.setNegativeButton("cancel",
DialogInterface.OnClickListener { dialog, which -> dialog.dismiss() })
builderSingle.setAdapter(arrayAdapter,
DialogInterface.OnClickListener { dialog, which ->
val strName = arrayAdapter.getItem(which)
val item = infos.get(which)
val builderInner: AlertDialog.Builder = AlertDialog.Builder(this@Intro)
builderInner.setMessage(strName)
builderInner.setTitle("${infos.get(which).title}로 이동 고고!?")
builderInner.setPositiveButton("Ok",
DialogInterface.OnClickListener {
dialog, which ->
reloadTo(item.makeLastInfo())
dialog.dismiss()
})
builderInner.setNeutralButton("삭제",
DialogInterface.OnClickListener {
dialog, which ->
var realm = openRealm()
realm?.writeBlocking {
this.query<HistoryItem>().query("title == '${item.title}'", ).find()?.last()?.let{
this.delete(it)
}
}
realm.close()
dialog.dismiss()
})
builderInner.setNegativeButton("취소",
DialogInterface.OnClickListener {
dialog, which ->
dialog.dismiss()
})
builderInner.show()
})
var ddddd= builderSingle.create()
ddddd.setOnShowListener { d->
(d as? AlertDialog)?.let{
it.listView?.setSelection(currentChapter)
}
}
ddddd.show()
}
fun showList(infos: BookPageInfos) {
val builderSingle: AlertDialog.Builder = AlertDialog.Builder(this@Intro)
builderSingle.setTitle("Select One Name:-")
builderSingle.setTitle("${currentTitle} : ${currentChapter} -> Select One ")
val arrayAdapter =
ArrayAdapter<String>(this@Intro, android.R.layout.select_dialog_singlechoice)
arrayAdapter.addAll(infos.getTitleArray())
@@ -164,60 +234,51 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
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 -> dialog.dismiss() })
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?.smoothScrollToPosition(currentChapter)
it.listView?.setSelection(currentChapter)
}
}
ddddd.show()
}
fun showStyleList() {
val builderSingle: AlertDialog.Builder = AlertDialog.Builder(this@Intro)
builderSingle.setTitle("Select One Name:-")
val arrayAdapter =
ArrayAdapter<String>(this@Intro, android.R.layout.select_dialog_singlechoice)
var styleNum = 1;
for (a in colors) {
arrayAdapter.add("스타일 ${styleNum}")
styleNum = styleNum.inc()
}
builderSingle.setNegativeButton("cancel",
DialogInterface.OnClickListener { dialog, which -> dialog.dismiss() })
builderSingle.setAdapter(arrayAdapter,
DialogInterface.OnClickListener { dialog, which ->
val color = colors.get(which)
val builderInner: AlertDialog.Builder = AlertDialog.Builder(this@Intro)
builderInner.setMessage("스타일 ${which + 1}")
builderInner.setTitle("Your Selected Item is")
builderInner.setPositiveButton("Ok",
DialogInterface.OnClickListener { dialog, which -> dialog.dismiss()
pg?.setColorStyle(color)
findViewById<View>(R.id.intro_bg).setBackgroundColor(Color.parseColor(color.get(1)))
})
builderInner.show()
})
var ddddd= builderSingle.create()
ddddd.setOnShowListener { d->
(d as? AlertDialog)?.let{
it.listView?.smoothScrollToPosition(currentChapter)
private fun moveTo(item: BookPageInfo?) {
item?.link?.let {newPath ->
mBaseWebContentsViewer?.webview?.url?.let{currentUrl ->
Uri.parse(currentUrl)?.lastPathSegment?.let {
currentUrl.replace(it,newPath)?.let {
mBaseWebContentsViewer?.webview?.loadUrl(it)
}
}
}
}
ddddd.show()
}
fun showStyleList() {
var mStylez = Stylez(this@Intro)
mStylez.styleSelectInterface = object : StyleSelectInterface {
override fun onSelectStyle(bgColor: String, textColor: String) {
pagedTextLayout?.setColorStyle(arrayOf(textColor,bgColor))
}
}
mStylez.show()
}
@@ -339,7 +400,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
}
}
}
var pg : PagedTextLayout? = null;
var pagedTextLayout : PagedTextLayout? = null;
var onNextClickAction: GotoSomeWhere? = null
override fun showNextBtn(find : Boolean , onClickAction: GotoSomeWhere) {
@@ -354,9 +415,9 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
}
fun actionNextEvent() {
if (pg != null && pg!!.visibility == View.VISIBLE && pg!!.size() > 0 && (pg!!.current() < pg!!.size() - 1) ) {
pg!!.doNext()
updateLastInfo(pg!!)
if (pagedTextLayout != null && pagedTextLayout!!.visibility == View.VISIBLE && pagedTextLayout!!.size() > 0 && (pagedTextLayout!!.current() < pagedTextLayout!!.size() - 1) ) {
pagedTextLayout!!.doNext()
updateLastInfo(pagedTextLayout!!)
}else {
onNextClickAction?.let { it() }
}
@@ -375,9 +436,9 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
fun actionPrevEvent() {
if (pg != null && pg!!.visibility == View.VISIBLE && pg!!.size() > 0 && pg!!.current() > 0 ) {
pg!!.doPrev()
updateLastInfo(pg!!)
if (pagedTextLayout != null && pagedTextLayout!!.visibility == View.VISIBLE && pagedTextLayout!!.size() > 0 && pagedTextLayout!!.current() > 0 ) {
pagedTextLayout!!.doPrev()
updateLastInfo(pagedTextLayout!!)
} else {
onPrevClickAction?.let{ it() }
}
@@ -407,10 +468,8 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
firstBackPress()
return
}
finish()
didBackPress = false
super.onBackPressed()
}
@@ -419,19 +478,19 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
}
override fun onLoadedContents(contents: String) {
pg = null;
pagedTextLayout = null;
findViewById<PagedTextLayout>(R.id.paged_layer).apply {
if (contents != null) {
pg = this
pagedTextLayout = this
visibility = VISIBLE
mPagedTextViewInterface = this@Intro
setText(contents.replace("\\n", System.getProperty("line.separator")))
setTextSize(22f)
if(lastInfo != null && lastInfo!!.pageUrl.equals(mBaseWebContentsViewer.webview.url)) {
this@Intro.findViewById<ProgressBar>(R.id.progress)?.visibility = VISIBLE
pg?.postDelayed({
pagedTextLayout?.postDelayed({
next(lastInfo!!.pageIndex)
pg?.post {
pagedTextLayout?.post {
this@Intro.findViewById<ProgressBar>(R.id.progress)?.visibility = GONE
}
},1000)
@@ -452,10 +511,21 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
Blog.LOGI(TAG,"onFindTitle >> " + contents + " ::: ${testRegex.replace(contents,"")}")
if(contents.contains("-")) {
currentTitle = contents.split("-")[0]
currentChapter = testRegex.replace(contents.split("-")[1],"").toInt()
try {
currentChapter = testRegex.replace(contents.split("-")[1],"").toInt()
} catch (e : Exception) {
currentChapter = 0
}
} else if(testRegex.replace(contents,"").length > 0){
currentChapter = testRegex.replace(contents,"").toInt()
currentTitle = contents.split(testRegex.replace(contents,""))[0]
} else {
val dateFormat = "yyyyMMdd-HH"
val date = Date(currentTimeMillis())
val simpleDateFormat = SimpleDateFormat(dateFormat)
currentTitle = simpleDateFormat.format(date)
}
}
override fun onStartLoad() {
@@ -463,39 +533,54 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
}
override fun completePageLoad(lastInfo: LastInfo) {
if(this.lastInfo == null || !(this.lastInfo?.pageUrl.equals(lastInfo?.pageUrl))) {
val configuration: Configuration = getResources().getConfiguration()
if(this.lastInfo == null || !(this.lastInfo?.pageUrl.equals(lastInfo?.pageUrl)) || this.lastInfo?.displayOrientation != configuration?.orientation) {
lastInfo.displayOrientation = configuration?.orientation ?: ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
saveLastInfo(lastInfo)
}
findViewById<ProgressBar>(R.id.progress).visibility = GONE
}
fun saveLastInfo(lastInfo: LastInfo) {
val windowManager = getSystemService(WINDOW_SERVICE)
val configuration: Configuration = getResources().getConfiguration()
val config = RealmConfiguration.Builder(setOf(LastInfo::class))
.schemaVersion(1)
.build()
val realm = Realm.open(config)
realm.writeBlocking {
lastInfo.displayOrientation = configuration.orientation
copyToRealm(lastInfo)
val realm = openRealm()
if((realm.query<LastInfo>()?.count()?.find() ?: 0) > 0) {
realm.writeBlocking {
this.query<LastInfo>()?.find()?.last()?.let{
it.pageUrl = lastInfo.pageUrl
it.title = currentTitle
it.chapter = currentChapter
it.pageIndex = lastInfo.pageIndex
it.contentsName = lastInfo.contentsName
it.displayOrientation = lastInfo.displayOrientation
this@Intro.lastInfo = copyFromRealm(it)
}
}
} else {
realm.writeBlocking {
copyToRealm(lastInfo)
}
}
Blog.LOGD(log ="Successfully opened realm: ${realm.configuration.name}")
realm.close()
}
fun updateLastInfo(pagedTextLayout: PagedTextLayout) {
val windowManager = getSystemService(WINDOW_SERVICE)
val configuration: Configuration = getResources().getConfiguration()
val config = RealmConfiguration.Builder(setOf(LastInfo::class))
.schemaVersion(1)
.build()
val realm = Realm.open(config)
val realm = openRealm()
realm.writeBlocking {
var info = this.query<LastInfo>()?.find()?.last()
info?.pageIndex = pagedTextLayout.current()
info?.displayOrientation = configuration.orientation
this.query<LastInfo>()?.find()?.last()?.let{
it.displayOrientation = configuration.orientation
it.title = currentTitle
it.chapter = currentChapter
it.pageIndex = pagedTextLayout.current()
this@Intro.lastInfo = copyFromRealm(it)
}
if (currentTitle.length > 0 && currentChapter > 0) {
this@Intro.lastInfo?.makeHistoryItem()?.let{
copyToRealm(it, UpdatePolicy.ALL)
}
}
}
Blog.LOGD(log ="Successfully opened realm: ${realm.configuration.name}")
@@ -522,7 +607,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
findViewById<View>(R.id.textView).visibility = VISIBLE
findViewById<View>(R.id.btn_home).visibility = VISIBLE
findViewById<View>(R.id.btn_list).visibility = VISIBLE
findViewById<View>(R.id.btn_menu).visibility = VISIBLE
findViewById<View>(R.id.btn_history).visibility = VISIBLE
findViewById<View>(R.id.btn_rotate).visibility = VISIBLE
}
@@ -561,7 +646,7 @@ class Intro : Base() , MainControllInterface, PagedTextViewInterface {
findViewById<View>(R.id.textView).visibility = GONE
findViewById<View>(R.id.btn_home).visibility = GONE
findViewById<View>(R.id.btn_list).visibility = GONE
findViewById<View>(R.id.btn_menu).visibility = GONE
findViewById<View>(R.id.btn_history).visibility = GONE
findViewById<View>(R.id.btn_rotate).visibility = GONE
}
@@ -0,0 +1,15 @@
package com.mime.dualscreenview.common
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")
)
@@ -0,0 +1,99 @@
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()
}
}
}
}
@@ -11,5 +11,5 @@ var list : ArrayList<BookPageInfo>? = null
}
class BookPageInfo {
var title : String? = ""
var lastPath : String? = ""
var link : String? = ""
}
@@ -7,15 +7,43 @@ import org.mongodb.kbson.ObjectId
class LastInfo() : RealmObject {
@PrimaryKey
var _id : String = "UniqLastId"
var pageUrl : String = ""
var title : String = ""
var contentsData : String = ""
var chapter : Int = 0
var pageIndex : Int = 0
var contentsName : String = ""
var displayOrientation : Int = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
}
fun makeHistoryItem() : HistoryItem = HistoryItem().apply {
title = this@LastInfo.title
pageUrl = this@LastInfo.pageUrl
chapter = this@LastInfo.chapter
pageIndex = this@LastInfo.pageIndex
contentsName = this@LastInfo.contentsName
displayOrientation = this@LastInfo.displayOrientation
}
}
class HistoryItem() : RealmObject {
@PrimaryKey
var title : String = ""
var pageUrl : String = ""
var chapter : Int = 0
var pageIndex : Int = 0
var contentsName : String = ""
var displayOrientation : Int = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
fun makeLastInfo() = LastInfo().apply{
_id = "UniqLastId"
title = this@HistoryItem.title
pageUrl = this@HistoryItem.pageUrl
chapter = this@HistoryItem.chapter
pageIndex = this@HistoryItem.pageIndex
contentsName = this@HistoryItem.contentsName
displayOrientation = this@HistoryItem.displayOrientation
}
}
class Bookmark() : RealmObject {
@PrimaryKey
var pageUrl : String = ""
@@ -66,7 +66,9 @@ class PagedTextLayout : ConstraintLayout , PagedTextGenerateInterface {
var isCenterTouch = TouchArea.Center.equals(touchArea)
hanler.removeCallbacks(touchTimeover)
mPagedTextViewInterface?.onTouch(touchArea)
hanler?.postDelayed(touchTimeover, 3000L)
if(isCenterTouch) {
hanler?.postDelayed(touchTimeover, 3000L)
}
}
})
}
@@ -8,7 +8,7 @@ import com.mime.dualscreenview.webcontents.contentsinfo.DidFindContents
abstract class BaseWebContents : ContentsInfoInterface {
var lastNumber : Int = 221
open var lastNumber : Int = 221
var completeAction : ActionByBool? = null
val definedActionCount = 5
var completeActionCount = 0
@@ -143,7 +143,7 @@ open class BaseWebContentsViewer {
currentContentsProvider?.doOnloaded(it , { result ->
result?.let { mainControllInterface.onLoadedContents(it) }
} , {
it?.let { mainControllInterface.onFindTitle(it) }
it?.let { mainControllInterface.onFindTitle(it.replace("\"","")) }
}, {btn ->
mainControllInterface?.showNextBtn (btn != null){
webview?.evaluateJavascript("if(document.getElementById('${currentContentsProvider!!.getNextButtonJs()}') != null) document.getElementById('${currentContentsProvider!!.getNextButtonJs()}').click()") {
@@ -4,7 +4,7 @@ import com.mime.dualscreenview.webcontents.BaseWebContents
class Booktoki : BaseWebContents() {
override var lastNumber : Int = 222
override fun getWebcontentsName(): String {
return "Booktoki"
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@@ -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="320dp"
android:layout_gravity="center"
android:layout_height="420dp"
xmlns:app="http://schemas.android.com/apk/res-auto">
<TextView
android:id="@+id/style_dialog_title"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="0dp"
android:gravity="center"
android:layout_height="@dimen/main_top_height"/>
<androidx.recyclerview.widget.RecyclerView
app:layout_constraintTop_toBottomOf="@id/style_dialog_title"
android:id="@+id/stylez_recyclerview"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="0dp"
android:layout_height="0dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
+3 -3
View File
@@ -80,18 +80,18 @@
android:background="#8FFF"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toRightOf="@id/btn_list"
app:layout_constraintRight_toLeftOf="@+id/btn_menu"
app:layout_constraintRight_toLeftOf="@+id/btn_history"
app:layout_constraintHorizontal_chainStyle="spread_inside"
/>
<ImageButton
android:id="@+id/btn_menu"
android:id="@+id/btn_history"
android:layout_width="wrap_content"
android:layout_height="@dimen/main_top_height"
android:adjustViewBounds="true"
android:scaleType="centerInside"
android:background="#8FFF"
android:src="@drawable/bookmark"
android:src="@drawable/history"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintHorizontal_chainStyle="spread_inside"
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="150dp"
android:layout_margin="5dp"
android:id="@+id/bg_sample"
android:layout_height="140dp">
<TextView
android:gravity="center"
android:text=""
android:id="@+id/textview_sample"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
+66
View File
@@ -2,4 +2,70 @@
<string name="app_name">DualScreenView</string>
<string name="display_the_second_screen">화면 옮 기 기</string>
<string name="main_desc">it\'s 두번째화면</string>
<string-array name="sample_textz">
<item>여섯글자마다&#160;방점을찍어놔
가사관찰하다&#160;반쯤놓치거나
해석잘안되면&#160;몇번돌리든가
이건이를테면&#160;덤비는리듬과
손묶인채붙는&#160;일종의노름판</item>
<item>신도구제불능&#160;내가물오른밤
감방에날가둬&#160;내가패를까도
가난한니네가&#160;판돈잃지않게
나하고니네가&#160;의견일치한게
아마처음일걸&#160;그마저운일걸</item>
<item>존나좋음이퀄&#160;내중저음일걸
이배열어쩌면&#160;너에대한배려
너에겐어쩌면&#160;언어적배리어
그럼넌글렀어&#160;지망생여기에
잠들다글로써&#160;훗날니묘비에</item>
<item>For&#160;sale&#160;my&#160;rhymes&#160;never&#160;used
For&#160;sale&#160;my&#160;rhymes&#160;never&#160;used
판매자바로너&#160;니가씨발오너
For&#160;sale&#160;my&#160;rhymes&#160;never&#160;used</item>
<item>노예처럼일해서왕처럼지배
성탄처럼지내설탕뿌려위에
성공을말했기에난그길위에
선딱그어이젠자봐주의깊게</item>
<item>멈칫할시간도없는듯써내려
활자로활짝갠곳에돈비내려
초라한핀조명과낮은무대위
목표를조준하기에충분했지</item>
<item>시인의신이될준비는치밀해
흘러군침이계속이기기위해
처음시작했던이유따윈잊어</item>
<item>맨발맨손으로역사들을빚어
미안해난비션갖고와내기적
자음모음이어리듬위에띄어
금은보화이쁜걸로손에끼워</item>
<item>Uh&#160;she&#160;suckin\'&#160;my&#160;soul&#160;like
De&#160;La&#160;to&#160;the&#160;Soul
I&#160;shout&#160;out&#160;to&#160;the&#160;Rhonda
But&#160;before&#160;I\'m&#160;sober</item>
<item>변태는&#160;변태인데&#160;underground&#160;모범생
맨날&#160;&#160;오덕&#160;&#160;활자에&#160;꼬여
&#160;팔자도&#160;고쳐낼&#160;하나의&#160;초월체를
만들려&#160;고쳐댄&#160;rhyme들만&#160;&#160;truck&#160;</item>
<item>그러다&#160;깨어나&#160;여기에
빼어난&#160;묘기에&#160;없네&#160;기본기
&#160;눈엔&#160;수명이&#160;대본처럼&#160;읽히네
뭐처럼&#160;비치네&#160;뭐처럼&#160;비치네</item>
<item>Fuck&#160;all&#160;of&#160;ya&#160;list&#160;man
If&#160;it&#160;ain\'t&#160;Forbes&#160;list&#160;mayne
Your&#160;wristwatch&#160;cheaper&#160;than
My&#160;profile&#160;picture&#160;damn</item>
<item>Picture&#160;the&#160;future&#160;and
믿어&#160;like&#160;it\'s&#160;happend
Big&#160;ass&#160;house&#160;foreign&#160;cars&#160;have&#160;several</item>
<item>미녀&#160;fine&#160;ass&#160;apple&#160;hip&#160;&#160;옆에&#160;같이&#160;태우고
Top&#160;of&#160;the&#160;top으로&#160;&#160;죽어야&#160;들어&#160;잠은
&#160;&#160;죽었다는&#160;
갖은&#160;&#160;잡으면&#160;뭐하냐</item>
<item>좆밥들&#160;&#160;반년만&#160;가면&#160;
&#160;들어가는&#160;&#160;&#160;보여
&#160;눈엔&#160;너가&#160;금방&#160;죽어
다음&#160;무덤&#160;&#160;들어갈&#160;주검
&#160;우물&#160;파는&#160;&#160;밟고서
땅을&#160;쳐봐&#160;&#160;발자국을</item>
</string-array>
</resources>