...
This commit is contained in:
@@ -82,6 +82,8 @@ import bums.lunatic.launcher.home.RssViewBuilder
|
||||
import bums.lunatic.launcher.model.RssData
|
||||
import bums.lunatic.launcher.model.RssDataType
|
||||
import bums.lunatic.launcher.receiver.NLService
|
||||
import bums.lunatic.launcher.tokiz.Comics
|
||||
import bums.lunatic.launcher.tokiz.Webtoons
|
||||
import bums.lunatic.launcher.utils.Blog
|
||||
import bums.lunatic.launcher.utils.FeedParseManager
|
||||
import bums.lunatic.launcher.utils.getJ
|
||||
@@ -307,9 +309,10 @@ internal class LauncherActivity : CommonActivity() {
|
||||
var onExit = false
|
||||
var lastAction = MotionEvent.ACTION_HOVER_EXIT
|
||||
override fun dispatchKeyEvent(ev: KeyEvent): Boolean {
|
||||
Blog.LOGE("dispatch ev?.device?.name >>> ${ev?.device?.name}")
|
||||
if (ev?.device?.name?.contains("SM-031N Mouse") == true) {
|
||||
val currentFragment = supportFragmentManager.findFragmentById(R.id.fragment_container)
|
||||
Blog.LOGE("dispatch ev?.device?.name >>> ${ev?.device?.name} , keyCode >> ${ev?.keyCode}")
|
||||
|
||||
if (ev?.device?.name?.contains("SM-031N Mouse") == true) {
|
||||
when(ev.action) {
|
||||
ACTION_UP -> {
|
||||
Blog.LOGE("dispatch dispatchKeyEvent>>> ${ev}")
|
||||
@@ -384,26 +387,42 @@ internal class LauncherActivity : CommonActivity() {
|
||||
}
|
||||
else {
|
||||
if(MotionEvent.ACTION_UP.equals(ev?.action ?: MotionEvent.ACTION_CANCEL) == true) {
|
||||
when (ev.keyCode) {
|
||||
return when (ev.keyCode) {
|
||||
KeyEvent.KEYCODE_VOLUME_DOWN -> {
|
||||
|
||||
novels?.actionNextEvent()
|
||||
return true
|
||||
if(currentFragment is Novels){ currentFragment.actionNextEvent() }
|
||||
true
|
||||
}
|
||||
|
||||
KeyEvent.KEYCODE_VOLUME_UP -> {
|
||||
novels?.actionPrevEvent()
|
||||
return true
|
||||
if(currentFragment is Novels){ currentFragment.actionPrevEvent() }
|
||||
true
|
||||
}
|
||||
else -> return false
|
||||
else -> false
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
return when (ev.keyCode) {
|
||||
KeyEvent.KEYCODE_VOLUME_DOWN -> {
|
||||
true
|
||||
}
|
||||
KeyEvent.KEYCODE_VOLUME_UP -> {
|
||||
true
|
||||
}
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.dispatchKeyEvent(ev)
|
||||
}
|
||||
|
||||
override fun dispatchTrackballEvent(event: MotionEvent?): Boolean {
|
||||
Blog.LOGE("event >>> ${event?.device}")
|
||||
return super.dispatchTrackballEvent(event`)
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
override fun dispatchKeyShortcutEvent(event: KeyEvent): Boolean {
|
||||
Blog.LOGE("event >>> ${event.device}")
|
||||
return super.dispatchKeyShortcutEvent(event)
|
||||
}
|
||||
|
||||
fun onClickCenterButton() {
|
||||
|
||||
@@ -545,11 +564,7 @@ internal class LauncherActivity : CommonActivity() {
|
||||
"android.intent.extra.EXTRA_START_REASON"
|
||||
).equals("startDockOrHome")
|
||||
) {
|
||||
if (binding.home.visibility == View.VISIBLE) {
|
||||
switchAppDrawer()
|
||||
} else {
|
||||
|
||||
}
|
||||
} else {
|
||||
intent?.extras?.keySet()?.forEach {
|
||||
try {
|
||||
@@ -576,8 +591,8 @@ internal class LauncherActivity : CommonActivity() {
|
||||
// }
|
||||
super.onNewIntent(intent)
|
||||
}
|
||||
var home : LauncherHome? = null
|
||||
var novels : Novels? = null
|
||||
|
||||
|
||||
@SuppressLint("NewApi", "MissingPermission")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
installSplashScreen()
|
||||
@@ -599,74 +614,40 @@ internal class LauncherActivity : CommonActivity() {
|
||||
|
||||
|
||||
binding.tabs.setOnCheckedChangeListener { g, id ->
|
||||
when(id) {
|
||||
R.id.feeds -> {
|
||||
if(binding.feeds.isChecked) {
|
||||
if (home == null) {
|
||||
home = binding.home.getFragment<LauncherHome>()
|
||||
}
|
||||
binding.home.visibility = View.VISIBLE
|
||||
binding.booktoki.visibility = View.GONE
|
||||
} else {
|
||||
binding.home.visibility = View.GONE
|
||||
if (novels == null) {
|
||||
novels = binding.booktoki.getFragment<Novels>()
|
||||
|
||||
} else {
|
||||
novels?.onResume()
|
||||
}
|
||||
binding.booktoki.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
R.id.book ->{
|
||||
if(binding.book.isChecked) {
|
||||
binding.home.visibility = View.GONE
|
||||
if (novels == null) {
|
||||
novels = binding.booktoki.getFragment<Novels>()
|
||||
} else {
|
||||
novels?.onResume()
|
||||
}
|
||||
binding.booktoki.visibility = View.VISIBLE
|
||||
} else {
|
||||
if (home == null) {
|
||||
home = binding.home.getFragment<LauncherHome>()
|
||||
}
|
||||
binding.home.visibility = View.VISIBLE
|
||||
binding.booktoki.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
showContents(id)
|
||||
}
|
||||
|
||||
/* handle navigation back events */
|
||||
handleBackPress()
|
||||
|
||||
val cn = ComponentName(this, NLService::class.java)
|
||||
val n = applicationContext.getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
||||
if (n.isNotificationListenerAccessGranted(cn)) {
|
||||
} else {
|
||||
val intent = Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS)
|
||||
startActivity(intent)
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
if (!isExternalStorageManager()) {
|
||||
try {
|
||||
startActivityForResult(Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION).apply {
|
||||
addCategory("android.intent.category.DEFAULT")
|
||||
data = Uri.parse(String.format("package:%s", applicationContext.packageName))
|
||||
}, 300)
|
||||
} catch (e: Exception) {
|
||||
startActivityForResult(Intent().apply {
|
||||
action = Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION
|
||||
}, 300)
|
||||
}
|
||||
}
|
||||
}
|
||||
updateLocationService()
|
||||
binding.book.isChecked = true
|
||||
binding.feeds.isChecked = true
|
||||
}
|
||||
|
||||
fun showContents(id : Int) {
|
||||
when(id) {
|
||||
R.id.feeds -> {
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(R.id.fragment_container, LauncherHome())
|
||||
.commit()
|
||||
}
|
||||
R.id.books ->{
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(R.id.fragment_container, Novels())
|
||||
.commit()
|
||||
}
|
||||
R.id.webtoons ->{
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(R.id.fragment_container, Webtoons())
|
||||
.commit()
|
||||
}
|
||||
R.id.comics ->{
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(R.id.fragment_container, Comics())
|
||||
.commit()
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
private fun initGeckoRuntime() {
|
||||
if (sRuntime == null) {
|
||||
try {
|
||||
@@ -697,14 +678,14 @@ internal class LauncherActivity : CommonActivity() {
|
||||
|
||||
super.onDestroy()
|
||||
}
|
||||
var blutoothManager : BluetoothManager? = null
|
||||
// var blutoothManager : BluetoothManager? = null
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
blutoothManager = BluetoothManager(this)
|
||||
blutoothManager?.register()
|
||||
blutoothManager?.initBluetoothAdapter()
|
||||
blutoothManager?.blueToothState()
|
||||
blutoothManager?.getPairedDevices()
|
||||
// blutoothManager = BluetoothManager(this)
|
||||
// blutoothManager?.register()
|
||||
// blutoothManager?.initBluetoothAdapter()
|
||||
// blutoothManager?.blueToothState()
|
||||
// blutoothManager?.getPairedDevices()
|
||||
statusBarView()
|
||||
setBgColor()
|
||||
}
|
||||
@@ -713,7 +694,7 @@ internal class LauncherActivity : CommonActivity() {
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
refreshFeeds()
|
||||
blutoothManager?.getPairedDevices()
|
||||
// blutoothManager?.getPairedDevices()
|
||||
Blog.LOGE("LauncherActivity onResume")
|
||||
}
|
||||
|
||||
@@ -760,11 +741,17 @@ internal class LauncherActivity : CommonActivity() {
|
||||
private fun handleBackPress() {
|
||||
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
if (binding.booktoki.isVisible) {
|
||||
finish()
|
||||
} else {
|
||||
finish()
|
||||
val currentFragment = supportFragmentManager.findFragmentById(R.id.fragment_container)
|
||||
when(currentFragment) {
|
||||
is LauncherHome ->{
|
||||
currentFragment.doNextPage()
|
||||
}
|
||||
}
|
||||
// if (binding.ho.isVisible) {
|
||||
// finish()
|
||||
// } else {
|
||||
// finish()
|
||||
// }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package bums.lunatic.launcher.home
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
@@ -16,6 +18,7 @@ import android.view.KeyEvent.KEYCODE_BUTTON_X
|
||||
import android.view.KeyEvent.KEYCODE_BUTTON_Y
|
||||
import android.view.KeyEvent.KEYCODE_DPAD_DOWN
|
||||
import android.view.KeyEvent.KEYCODE_DPAD_UP
|
||||
import android.widget.ProgressBar
|
||||
import bums.lunatic.launcher.LauncherActivity.Companion.getRuntime
|
||||
import bums.lunatic.launcher.tokiz.view.BWebview
|
||||
import bums.lunatic.launcher.tokiz.view.JxEvent
|
||||
@@ -47,7 +50,7 @@ class GeckoWeb : BWebview {
|
||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {
|
||||
buildWeb()
|
||||
}
|
||||
|
||||
var progress : ProgressBar? = null
|
||||
val mPortNam = "browser"
|
||||
val extPath = "resource://android/assets/extensions/my_extension/"
|
||||
val extId = "messaging@booktoki468.com"
|
||||
@@ -168,7 +171,7 @@ class GeckoWeb : BWebview {
|
||||
session: GeckoSession,
|
||||
mediaSession: MediaSession
|
||||
) {
|
||||
Blog.LOGE("onPlay")
|
||||
Blog.LOGE("onPlay $mediaSession")
|
||||
super.onPlay(session, mediaSession)
|
||||
}
|
||||
|
||||
@@ -184,7 +187,7 @@ class GeckoWeb : BWebview {
|
||||
session: GeckoSession,
|
||||
mediaSession: MediaSession
|
||||
) {
|
||||
Blog.LOGE("onStop")
|
||||
Blog.LOGE("onStop $mediaSession")
|
||||
super.onStop(session, mediaSession)
|
||||
}
|
||||
|
||||
@@ -275,8 +278,21 @@ class GeckoWeb : BWebview {
|
||||
super.onSessionStateChange(session, sessionState)
|
||||
}
|
||||
|
||||
override fun onProgressChange(session: GeckoSession, progress: Int) {
|
||||
super.onProgressChange(session, progress)
|
||||
this@GeckoWeb.progress?.setProgress(progress,true)
|
||||
}
|
||||
override fun onPageStart(session: GeckoSession, url: String) {
|
||||
super.onPageStart(session, url)
|
||||
if (url?.contains("reddit.app.link") == true) {
|
||||
session.stop()
|
||||
Uri.parse(url)?.let { uri ->
|
||||
context.startActivity(Intent().apply {
|
||||
action = Intent.ACTION_VIEW
|
||||
data = uri
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPageStop(session: GeckoSession, success: Boolean) {
|
||||
@@ -325,6 +341,7 @@ class GeckoWeb : BWebview {
|
||||
// url이 현재 로드된 주소입니다.
|
||||
Blog.LOGE("GeckoView", "현재 주소: $url")
|
||||
Blog.LOGE("GeckoView", "현재 session: $session")
|
||||
|
||||
url?.let { url ->
|
||||
if (url.split("//").size > 1) {
|
||||
url.replace("//", "/").replace("https:/", "https://").let {
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.view.LayoutInflater
|
||||
import android.view.PointerIcon
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
@@ -261,7 +262,7 @@ internal class LauncherHome : Fragment() {
|
||||
binding.infoList.visibility = View.VISIBLE
|
||||
binding.infoList.adapter = mRssAdapter
|
||||
binding.infoList.setOnTouchListener { v,e ->
|
||||
if (e.device.name?.contains("JX-12",true) == true) {
|
||||
if (e.device.name?.contains("JX-12",true) == true|| e.device.name?.equals("J06",true) == true) {
|
||||
Blog.LOGE("touchEvent -> ${e}")
|
||||
return@setOnTouchListener mSimpleFingerGestures.onTouch(v,e)
|
||||
} else {
|
||||
@@ -270,6 +271,7 @@ internal class LauncherHome : Fragment() {
|
||||
}
|
||||
}
|
||||
queryInfos()
|
||||
binding.geckoWeb.progress = binding.progressBar
|
||||
binding.geckoWeb.jxInteface = { jxEvent ->
|
||||
when(jxEvent) {
|
||||
JxEvent.SCROLL_UP -> binding.geckoWeb.sendScrollDown(false)
|
||||
@@ -285,6 +287,9 @@ internal class LauncherHome : Fragment() {
|
||||
}
|
||||
}
|
||||
}
|
||||
val nullCursor = PointerIcon.getSystemIcon(context!!, PointerIcon.TYPE_NULL)
|
||||
binding.root.setPointerIcon(nullCursor)
|
||||
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@@ -336,7 +341,7 @@ internal class LauncherHome : Fragment() {
|
||||
delete(
|
||||
query<RssData>()
|
||||
.query("pubDate < $0", beforeDay(30))
|
||||
.query("category != $0 AND category != $1 ", RssDataType.GURU.name, RssDataType.MOST.name)
|
||||
// .query("category != $0 AND category != $1 ", RssDataType.GURU.name, RssDataType.MOST.name)
|
||||
.query("vote != $0", true).find()
|
||||
)
|
||||
}
|
||||
@@ -369,7 +374,7 @@ internal class LauncherHome : Fragment() {
|
||||
beforeQuery()
|
||||
var rQ = WorkersDb.getRealm().query<RssData>().query("read < $0", nomoreShowCount).distinct("originPage", "title")
|
||||
if (!noLimit) rQ.query("pubDate > $0", beforeOneDay())
|
||||
((filter?.size ?: 0) > 0).letTrue {filter!!.forEach {rQ = rQ.query("category != $0", it.name)}}
|
||||
// ((filter?.size ?: 0) > 0).letTrue {filter!!.forEach {rQ = rQ.query("category != $0", it.name)}}
|
||||
updateQuery(rQ)
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
||||
private val swipeTime = 300 // 스와이프 최대 시간(ms)
|
||||
private val clickThreshold = 30 // 클릭으로 인정할 최대 이동 거리(px)
|
||||
override fun onTouch(v: View?, event: MotionEvent): Boolean {
|
||||
if(event.device.name.equals("JX-12",true)) {
|
||||
if (event.device.name?.contains("JX-12",true) == true|| event.device.name?.equals("J06",true) == true) {
|
||||
when (event.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
startX = event.x
|
||||
|
||||
@@ -220,7 +220,7 @@ internal class RssItemAdapter (
|
||||
event: MotionEvent
|
||||
): Boolean {
|
||||
Blog.LOGE("event.device.name >>> ${event.device.name}")
|
||||
if (event.device.name?.contains("JX-12",true) == true) {
|
||||
if (event.device.name?.contains("JX-12",true) == true|| event.device.name?.equals("J06",true) == true) {
|
||||
return true//mSimpleFingerGestures.onTouch(v,event)
|
||||
} else {
|
||||
return false
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,182 @@
|
||||
package bums.lunatic.launcher.tokiz
|
||||
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Color
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import android.text.InputType
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.style.RelativeSizeSpan
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.View.GONE
|
||||
import android.view.View.OnTouchListener
|
||||
import android.view.View.VISIBLE
|
||||
import android.view.View.inflate
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.EditText
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.net.toUri
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.Fragment
|
||||
import bums.lunatic.launcher.LauncherActivity.Companion.getRuntime
|
||||
import bums.lunatic.launcher.R
|
||||
import bums.lunatic.launcher.tokiz.common.PairArray
|
||||
import bums.lunatic.launcher.tokiz.common.TouchArea
|
||||
import bums.lunatic.launcher.tokiz.common.colorz
|
||||
import bums.lunatic.launcher.tokiz.common.getIndex
|
||||
import bums.lunatic.launcher.tokiz.common.typesfacez
|
||||
import bums.lunatic.launcher.tokiz.data.HistoryManager
|
||||
import bums.lunatic.launcher.tokiz.data.model.ContentsPageInfo
|
||||
import bums.lunatic.launcher.tokiz.data.model.ContentsCollection
|
||||
import bums.lunatic.launcher.tokiz.data.model.PageInfosJ
|
||||
import bums.lunatic.launcher.tokiz.data.model.HistoryItem
|
||||
import bums.lunatic.launcher.tokiz.data.model.LastInfo
|
||||
import bums.lunatic.launcher.tokiz.data.model.PortMessage
|
||||
import bums.lunatic.launcher.tokiz.data.model.ReaderConfig
|
||||
import bums.lunatic.launcher.tokiz.dialog.DefaultList
|
||||
import bums.lunatic.launcher.tokiz.view.JxEvent
|
||||
import bums.lunatic.launcher.tokiz.view.PagedTextLayout
|
||||
import bums.lunatic.launcher.tokiz.view.PagedTextViewInterface
|
||||
import bums.lunatic.launcher.databinding.BooktokiBinding
|
||||
import bums.lunatic.launcher.utils.Blog
|
||||
import com.google.gson.Gson
|
||||
import io.realm.kotlin.Realm
|
||||
import io.realm.kotlin.UpdatePolicy
|
||||
import io.realm.kotlin.ext.copyFromRealm
|
||||
import io.realm.kotlin.ext.query
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
import org.mozilla.gecko.util.ThreadUtils
|
||||
import org.mozilla.geckoview.GeckoResult
|
||||
import org.mozilla.geckoview.GeckoSession
|
||||
import org.mozilla.geckoview.MediaSession
|
||||
import org.mozilla.geckoview.WebExtension
|
||||
import org.mozilla.geckoview.WebExtension.MessageDelegate
|
||||
import org.mozilla.geckoview.WebExtension.PortDelegate
|
||||
import org.mozilla.geckoview.WebExtensionController.AddonManagerDelegate
|
||||
import org.mozilla.geckoview.WebRequestError
|
||||
import java.lang.System.currentTimeMillis
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.collections.List
|
||||
import kotlin.collections.MutableList
|
||||
import kotlin.collections.arrayListOf
|
||||
import kotlin.collections.first
|
||||
import kotlin.collections.isNotEmpty
|
||||
import kotlin.collections.last
|
||||
import kotlin.collections.sortBy
|
||||
import kotlin.random.Random
|
||||
import kotlin.text.contains
|
||||
import kotlin.text.endsWith
|
||||
import kotlin.text.equals
|
||||
import kotlin.text.replace
|
||||
import kotlin.text.split
|
||||
import kotlin.text.startsWith
|
||||
import kotlin.text.toInt
|
||||
import kotlin.text.toRegex
|
||||
import kotlin.text.trim
|
||||
|
||||
|
||||
class Comics : BaseToki(), PagedTextViewInterface {
|
||||
|
||||
override val contentsType = "comics"
|
||||
override var lastNumber : Int = 468
|
||||
override val webcontentsName : String = "manatoki"
|
||||
override val afterDot = "net"
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
loadLastInfo()
|
||||
}
|
||||
|
||||
override fun onTouch(touchArea: TouchArea) {
|
||||
Blog.LOGD(log = "onTouch ${touchArea}")
|
||||
when (touchArea) {
|
||||
TouchArea.Center -> {
|
||||
|
||||
}
|
||||
|
||||
TouchArea.Right -> {
|
||||
actionNextEvent()
|
||||
}
|
||||
|
||||
TouchArea.Left -> {
|
||||
actionPrevEvent()
|
||||
}
|
||||
|
||||
TouchArea.DoubleRight -> {
|
||||
actionNextEvent(true)
|
||||
}
|
||||
|
||||
TouchArea.DoubleLeft -> {
|
||||
actionPrevEvent(true)
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun onLongClick() {
|
||||
Blog.LOGD(log = "onLongClick")
|
||||
|
||||
}
|
||||
|
||||
override fun onSwipeLeft(count: Int) {
|
||||
Blog.LOGD(log = "onSwipeLeft ${count}")
|
||||
actionNextEvent(count > 1)
|
||||
|
||||
}
|
||||
|
||||
override fun onSwipeRight(count: Int) {
|
||||
Blog.LOGD(log = "onSwipeRight ${count}")
|
||||
actionPrevEvent(count > 1)
|
||||
}
|
||||
|
||||
override fun onSwipeUp(touchCount: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onSwipeDown(touchCount: Int) {
|
||||
if (touchCount == 2) {
|
||||
if (binding.pagedLayer.isVisible) {
|
||||
binding.pagedLayer.visibility = GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTimeoverTouch() {
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,183 @@
|
||||
package bums.lunatic.launcher.tokiz
|
||||
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Color
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import android.text.InputType
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.style.RelativeSizeSpan
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.View.GONE
|
||||
import android.view.View.OnTouchListener
|
||||
import android.view.View.VISIBLE
|
||||
import android.view.View.inflate
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.EditText
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.net.toUri
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.Fragment
|
||||
import bums.lunatic.launcher.LauncherActivity.Companion.getRuntime
|
||||
import bums.lunatic.launcher.R
|
||||
import bums.lunatic.launcher.tokiz.common.PairArray
|
||||
import bums.lunatic.launcher.tokiz.common.TouchArea
|
||||
import bums.lunatic.launcher.tokiz.common.colorz
|
||||
import bums.lunatic.launcher.tokiz.common.getIndex
|
||||
import bums.lunatic.launcher.tokiz.common.typesfacez
|
||||
import bums.lunatic.launcher.tokiz.data.HistoryManager
|
||||
import bums.lunatic.launcher.tokiz.data.model.ContentsPageInfo
|
||||
import bums.lunatic.launcher.tokiz.data.model.ContentsCollection
|
||||
import bums.lunatic.launcher.tokiz.data.model.PageInfosJ
|
||||
import bums.lunatic.launcher.tokiz.data.model.HistoryItem
|
||||
import bums.lunatic.launcher.tokiz.data.model.LastInfo
|
||||
import bums.lunatic.launcher.tokiz.data.model.PortMessage
|
||||
import bums.lunatic.launcher.tokiz.data.model.ReaderConfig
|
||||
import bums.lunatic.launcher.tokiz.dialog.DefaultList
|
||||
import bums.lunatic.launcher.tokiz.view.JxEvent
|
||||
import bums.lunatic.launcher.tokiz.view.PagedTextLayout
|
||||
import bums.lunatic.launcher.tokiz.view.PagedTextViewInterface
|
||||
import bums.lunatic.launcher.databinding.BooktokiBinding
|
||||
import bums.lunatic.launcher.utils.Blog
|
||||
import com.google.gson.Gson
|
||||
import io.realm.kotlin.Realm
|
||||
import io.realm.kotlin.UpdatePolicy
|
||||
import io.realm.kotlin.ext.copyFromRealm
|
||||
import io.realm.kotlin.ext.query
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
import org.mozilla.gecko.util.ThreadUtils
|
||||
import org.mozilla.geckoview.GeckoResult
|
||||
import org.mozilla.geckoview.GeckoSession
|
||||
import org.mozilla.geckoview.MediaSession
|
||||
import org.mozilla.geckoview.WebExtension
|
||||
import org.mozilla.geckoview.WebExtension.MessageDelegate
|
||||
import org.mozilla.geckoview.WebExtension.PortDelegate
|
||||
import org.mozilla.geckoview.WebExtensionController.AddonManagerDelegate
|
||||
import org.mozilla.geckoview.WebRequestError
|
||||
import java.lang.System.currentTimeMillis
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.collections.List
|
||||
import kotlin.collections.MutableList
|
||||
import kotlin.collections.arrayListOf
|
||||
import kotlin.collections.first
|
||||
import kotlin.collections.isNotEmpty
|
||||
import kotlin.collections.last
|
||||
import kotlin.collections.sortBy
|
||||
import kotlin.random.Random
|
||||
import kotlin.text.contains
|
||||
import kotlin.text.endsWith
|
||||
import kotlin.text.equals
|
||||
import kotlin.text.replace
|
||||
import kotlin.text.split
|
||||
import kotlin.text.startsWith
|
||||
import kotlin.text.toInt
|
||||
import kotlin.text.toRegex
|
||||
import kotlin.text.trim
|
||||
|
||||
|
||||
class Webtoons : BaseToki(), PagedTextViewInterface {
|
||||
|
||||
override val contentsType = "webtoon"
|
||||
override var lastNumber : Int = 468
|
||||
override val webcontentsName : String = "newtoki"
|
||||
override val afterDot = "com"
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
loadLastInfo()
|
||||
Blog.LOGE("binding.root >>> ${binding.root}")
|
||||
}
|
||||
|
||||
override fun onTouch(touchArea: TouchArea) {
|
||||
Blog.LOGD(log = "onTouch ${touchArea}")
|
||||
when (touchArea) {
|
||||
TouchArea.Center -> {
|
||||
|
||||
}
|
||||
|
||||
TouchArea.Right -> {
|
||||
actionNextEvent()
|
||||
}
|
||||
|
||||
TouchArea.Left -> {
|
||||
actionPrevEvent()
|
||||
}
|
||||
|
||||
TouchArea.DoubleRight -> {
|
||||
actionNextEvent(true)
|
||||
}
|
||||
|
||||
TouchArea.DoubleLeft -> {
|
||||
actionPrevEvent(true)
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun onLongClick() {
|
||||
Blog.LOGD(log = "onLongClick")
|
||||
|
||||
}
|
||||
|
||||
override fun onSwipeLeft(count: Int) {
|
||||
Blog.LOGD(log = "onSwipeLeft ${count}")
|
||||
actionNextEvent(count > 1)
|
||||
|
||||
}
|
||||
|
||||
override fun onSwipeRight(count: Int) {
|
||||
Blog.LOGD(log = "onSwipeRight ${count}")
|
||||
actionPrevEvent(count > 1)
|
||||
}
|
||||
|
||||
override fun onSwipeUp(touchCount: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onSwipeDown(touchCount: Int) {
|
||||
if (touchCount == 2) {
|
||||
if (binding.pagedLayer.isVisible) {
|
||||
binding.pagedLayer.visibility = GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTimeoverTouch() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package bums.lunatic.launcher.tokiz.common
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import bums.lunatic.launcher.tokiz.webcontents.contentsinfo.BooktokiStruct
|
||||
import bums.lunatic.launcher.utils.Blog
|
||||
|
||||
object PrefManager {
|
||||
@@ -20,9 +19,9 @@ object PrefManager {
|
||||
return main.getString(key, "")
|
||||
}
|
||||
|
||||
fun getLastDomain() : String {
|
||||
return main.getString(domainKey, BooktokiStruct.getLastedDoamin()) ?: BooktokiStruct.getLastedDoamin()
|
||||
}
|
||||
// fun getLastDomain() : String {
|
||||
// return main.getString(domainKey, BooktokiStruct.getLastedDoamin()) ?: BooktokiStruct.getLastedDoamin()
|
||||
// }
|
||||
fun putLastDomain(domain : String) {
|
||||
Blog.LOGE("domain >>> ${domain}")
|
||||
main.edit().putString(domainKey,domain).apply()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package bums.lunatic.launcher.tokiz.data
|
||||
|
||||
import bums.lunatic.launcher.tokiz.data.model.BookPageInfo
|
||||
import bums.lunatic.launcher.tokiz.data.model.BookPageInfos
|
||||
import bums.lunatic.launcher.tokiz.data.model.ContentsPageInfo
|
||||
import bums.lunatic.launcher.tokiz.data.model.ContentsCollection
|
||||
import bums.lunatic.launcher.tokiz.data.model.HistoryItem
|
||||
import bums.lunatic.launcher.tokiz.data.model.LastInfo
|
||||
import bums.lunatic.launcher.tokiz.data.model.ReaderConfig
|
||||
@@ -45,9 +45,9 @@ object HistoryManager {
|
||||
}
|
||||
}
|
||||
|
||||
fun getBookInfos(aUrl : String, callback : (BookPageInfos?)->Unit) {
|
||||
fun getBookInfos(contentsType : String,aUrl : String, callback : (ContentsCollection?)->Unit) {
|
||||
var url : String = aUrl
|
||||
Blog.LOGE("aUrl >>> ${aUrl}")
|
||||
Blog.LOGE("aUrl >>> ${aUrl} , contentsType ${contentsType}")
|
||||
openRealm.apply{
|
||||
if (url.startsWith("//")) {
|
||||
while (url.startsWith("//")) {
|
||||
@@ -55,15 +55,17 @@ object HistoryManager {
|
||||
}
|
||||
}
|
||||
Blog.LOGE("aUrl >>> ${url}")
|
||||
var bookPageInfo = this.query(BookPageInfo::class).query("pathUrl == $0 || bookPageUrl == $0","${url}").find()
|
||||
if (bookPageInfo != null && bookPageInfo.count() > 0) {
|
||||
Blog.LOGE("get ${bookPageInfo}" )
|
||||
var pgs = this.query(BookPageInfos::class,"bookPageUrl == $0", bookPageInfo.first().bookPageUrl).find()
|
||||
var contentsPageInfo = this.query(ContentsPageInfo::class).query("contentsType == $0", contentsType).query("pathUrl == $0 || bookPageUrl == $0","${url}").find()
|
||||
if (contentsPageInfo != null && contentsPageInfo.count() > 0) {
|
||||
Blog.LOGE("get ${contentsPageInfo}" )
|
||||
var pgs = this.query(ContentsCollection::class,"bookPageUrl == $0", contentsPageInfo.first().bookPageUrl).find()
|
||||
if (pgs.size > 0) {
|
||||
pgs.first().let {
|
||||
Blog.LOGE("get ${it} , ${it?.pages}")
|
||||
callback.invoke(this.copyFromRealm(it))
|
||||
}
|
||||
} else {
|
||||
callback.invoke(null)
|
||||
}
|
||||
} else {
|
||||
callback.invoke(null)
|
||||
@@ -71,7 +73,7 @@ object HistoryManager {
|
||||
}
|
||||
}
|
||||
|
||||
fun getBookPageInfo(aUrl : String, callback : (BookPageInfo?)->Unit) {
|
||||
fun getBookPageInfo(contentsType : String, aUrl : String, callback : (ContentsPageInfo?)->Unit) {
|
||||
var url : String = aUrl
|
||||
openRealm.apply{
|
||||
if (url.startsWith("//")) {
|
||||
@@ -79,7 +81,7 @@ object HistoryManager {
|
||||
url = url.replace("//","/").trim()
|
||||
}
|
||||
}
|
||||
var result = this.query(BookPageInfo::class).query("pathUrl == $0","${url}").find()
|
||||
var result = this.query(ContentsPageInfo::class).query("contentsType == $0", contentsType).query("pathUrl == $0","${url}").find()
|
||||
if (result.size > 0) {
|
||||
var bookPageInfo = result?.first()
|
||||
if (bookPageInfo != null) {
|
||||
@@ -93,7 +95,7 @@ object HistoryManager {
|
||||
}
|
||||
}
|
||||
|
||||
fun setBookPageInfo(aUrl : String, page :Int) {
|
||||
fun setBookPageInfo(contentsType : String,aUrl : String, page :Int) {
|
||||
var url : String = aUrl
|
||||
openRealm.writeBlocking {
|
||||
if (url.startsWith("//")) {
|
||||
@@ -101,7 +103,7 @@ object HistoryManager {
|
||||
url = url.replace("//","/").trim()
|
||||
}
|
||||
}
|
||||
var result = this.query(BookPageInfo::class).query("pathUrl == $0","${url}").find()
|
||||
var result = this.query(ContentsPageInfo::class).query("contentsType == $0", contentsType).query("pathUrl == $0","${url}").find()
|
||||
if (result.size > 0) {
|
||||
var bookPageInfo = result?.first()
|
||||
if (bookPageInfo != null) {
|
||||
@@ -111,13 +113,13 @@ object HistoryManager {
|
||||
}
|
||||
}
|
||||
|
||||
fun getBooPageInfoContentsSave(aUrl : String, contents : String) {
|
||||
fun getBooPageInfoContentsSave(contentsType : String,aUrl : String, contents : String) {
|
||||
var url : String = if (aUrl.startsWith("//") || aUrl.startsWith("///") || aUrl.startsWith("////")) {
|
||||
aUrl.replace("////","/").replace("///","/").replace("//","/")
|
||||
} else aUrl
|
||||
openRealm.writeBlocking {
|
||||
Blog.LOGE("getBooPageInfoContentsSave ${url}")
|
||||
val result = query(BookPageInfo::class).query("pathUrl == $0", "${url}").find()
|
||||
val result = query(ContentsPageInfo::class).query("contentsType == $0", contentsType).query("pathUrl == $0", "${url}").find()
|
||||
if (result.size > 0) {
|
||||
result.first().contents = contents
|
||||
copyToRealm(result.first(), UpdatePolicy.ALL)
|
||||
@@ -128,7 +130,7 @@ object HistoryManager {
|
||||
|
||||
|
||||
|
||||
fun getNextPage(aUrl : String ,callback : (BookPageInfo?)->Unit) {
|
||||
fun getNextPage(contentsType : String,aUrl : String ,callback : (ContentsPageInfo?)->Unit) {
|
||||
var url : String = aUrl
|
||||
openRealm.apply{
|
||||
if (url.startsWith("//")) {
|
||||
@@ -136,11 +138,11 @@ object HistoryManager {
|
||||
url = url.replace("//","/").trim()
|
||||
}
|
||||
}
|
||||
var bookPageInfo =
|
||||
this.query(BookPageInfo::class).query("pathUrl == $0", url).find()
|
||||
if (bookPageInfo.size > 0) {
|
||||
Blog.LOGE("getNextPage 2 => chapterNum : ${bookPageInfo.first().chapterNum} , bookPageInfo.bookPageUrl : ${bookPageInfo.first().bookPageUrl}" )
|
||||
var results = this.query(BookPageInfo::class).query("chapterNum == $0",bookPageInfo.first().chapterNum + 1).query("bookPageUrl == $0","${bookPageInfo.first().bookPageUrl}").find()
|
||||
var contentsPageInfo =
|
||||
this.query(ContentsPageInfo::class).query("contentsType == $0", contentsType).query("pathUrl == $0", url).find()
|
||||
if (contentsPageInfo.size > 0) {
|
||||
Blog.LOGE("getNextPage 2 => chapterNum : ${contentsPageInfo.first().chapterNum} , bookPageInfo.bookPageUrl : ${contentsPageInfo.first().bookPageUrl}" )
|
||||
var results = this.query(ContentsPageInfo::class).query("chapterNum == $0",contentsPageInfo.first().chapterNum + 1).query("bookPageUrl == $0","${contentsPageInfo.first().bookPageUrl}").find()
|
||||
if(results.size > 0) {
|
||||
results.first().let {
|
||||
Blog.LOGE("getNextPage 2 nextBook pathUrl : ${it.pathUrl}" )
|
||||
@@ -152,7 +154,7 @@ object HistoryManager {
|
||||
}
|
||||
|
||||
|
||||
fun getPrevPage(aUrl : String ,callback : (BookPageInfo?)->Unit) {
|
||||
fun getPrevPage(contentsType : String,aUrl : String ,callback : (ContentsPageInfo?)->Unit) {
|
||||
var url : String = aUrl
|
||||
openRealm.apply{
|
||||
Blog.LOGE("getPrevPage ${url}" )
|
||||
@@ -162,13 +164,13 @@ object HistoryManager {
|
||||
}
|
||||
}
|
||||
Blog.LOGE("getPrevPage ${url}" )
|
||||
var bookPageInfo =
|
||||
this.query(BookPageInfo::class).query("pathUrl == $0", url).find()
|
||||
Blog.LOGE("getPrevPage ${bookPageInfo}" )
|
||||
if (bookPageInfo.size > 0) {
|
||||
Blog.LOGE("getPrevPage 2 ${bookPageInfo?.first()?.chapterNum}" )
|
||||
Blog.LOGE("getPrevPage 2 ${bookPageInfo?.first()?.bookPageUrl}" )
|
||||
var results = this.query(BookPageInfo::class).query("chapterNum == $0",bookPageInfo.first().chapterNum - 1).query("bookPageUrl == $0","${bookPageInfo.first().bookPageUrl}").find()
|
||||
var contentsPageInfo =
|
||||
this.query(ContentsPageInfo::class).query("contentsType == $0", contentsType).query("pathUrl == $0", url).find()
|
||||
Blog.LOGE("getPrevPage ${contentsPageInfo}" )
|
||||
if (contentsPageInfo.size > 0) {
|
||||
Blog.LOGE("getPrevPage 2 ${contentsPageInfo?.first()?.chapterNum}" )
|
||||
Blog.LOGE("getPrevPage 2 ${contentsPageInfo?.first()?.bookPageUrl}" )
|
||||
var results = this.query(ContentsPageInfo::class).query("chapterNum == $0",contentsPageInfo.first().chapterNum - 1).query("bookPageUrl == $0","${contentsPageInfo.first().bookPageUrl}").find()
|
||||
if(results.size > 0) {
|
||||
results.first()?.let {
|
||||
Blog.LOGE("getPrevPage 2 ${it.bookPageUrl}" )
|
||||
|
||||
+20
-16
@@ -7,7 +7,7 @@ import io.realm.kotlin.types.annotations.PrimaryKey
|
||||
|
||||
class PortMessage {
|
||||
var type : String? = ""
|
||||
var bookInfos : BookPageInfosJ? = null
|
||||
var bookInfos : PageInfosJ? = null
|
||||
var book : BookContents? = null
|
||||
var msg : String? = null
|
||||
}
|
||||
@@ -16,11 +16,11 @@ class BookContents {
|
||||
var bookContents : String? = null
|
||||
}
|
||||
|
||||
class BookPageInfosJ {
|
||||
class PageInfosJ {
|
||||
var bookTitle : String = ""
|
||||
var bookPageUrl : String = ""
|
||||
|
||||
var pages : ArrayList<BookPageInfoJ> = arrayListOf<BookPageInfoJ>()
|
||||
var contentsType : String? = ""
|
||||
var pages : ArrayList<PageInfoJ> = arrayListOf<PageInfoJ>()
|
||||
|
||||
fun getTitleArray() : ArrayList<String> {
|
||||
var arrayList = ArrayList<String>()
|
||||
@@ -28,15 +28,16 @@ class BookPageInfosJ {
|
||||
return arrayList
|
||||
}
|
||||
|
||||
fun getR() : BookPageInfos{
|
||||
var r = BookPageInfos()
|
||||
fun getR() : ContentsCollection{
|
||||
var r = ContentsCollection()
|
||||
r.bookTitle = this.bookTitle
|
||||
r.bookPageUrl = this.bookPageUrl
|
||||
|
||||
r.contentsType = this.contentsType
|
||||
return r
|
||||
}
|
||||
}
|
||||
class BookPageInfoJ {
|
||||
|
||||
class PageInfoJ {
|
||||
var chapterID : Int = 0
|
||||
var contents : String? = ""
|
||||
var bookPageUrl : String? = ""
|
||||
@@ -45,9 +46,10 @@ class BookPageInfoJ {
|
||||
var chapterNum : Int = 0
|
||||
var lastPage : Int? = 0
|
||||
var pathUrl : String? = ""
|
||||
var contentsType : String? = ""
|
||||
|
||||
fun getRealm() : BookPageInfo {
|
||||
var r = BookPageInfo()
|
||||
fun getRealm() : ContentsPageInfo {
|
||||
var r = ContentsPageInfo()
|
||||
r.chapterID = this.chapterID
|
||||
r.contents = this.contents
|
||||
r.bookPageUrl = this.bookPageUrl ?: ""
|
||||
@@ -56,19 +58,20 @@ class BookPageInfoJ {
|
||||
r.chapterNum = this.chapterNum
|
||||
r.lastPage = this.lastPage
|
||||
r.pathUrl = this.pathUrl?.replace("'","")
|
||||
|
||||
r.contentsType = this.contentsType
|
||||
return r
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class BookPageInfos : RealmObject {
|
||||
class ContentsCollection : RealmObject {
|
||||
|
||||
var bookTitle : String = ""
|
||||
|
||||
@PrimaryKey
|
||||
var bookPageUrl : String? = ""
|
||||
var pages : RealmList<BookPageInfo> = realmListOf()
|
||||
var pages : RealmList<ContentsPageInfo> = realmListOf()
|
||||
var contentsType : String? = ""
|
||||
|
||||
fun getTitleArray() : ArrayList<String> {
|
||||
var arrayList = ArrayList<String>()
|
||||
@@ -78,11 +81,11 @@ class BookPageInfos : RealmObject {
|
||||
}
|
||||
|
||||
fun sort() {
|
||||
val comparator : Comparator<BookPageInfo> = compareBy { it.chapterID }
|
||||
val comparator : Comparator<ContentsPageInfo> = compareBy { it.chapterID }
|
||||
pages.sortWith(comparator)
|
||||
}
|
||||
|
||||
fun hasItem(item: BookPageInfo) : Boolean {
|
||||
fun hasItem(item: ContentsPageInfo) : Boolean {
|
||||
var hasItem = false
|
||||
for (c in pages) {
|
||||
if (!hasItem) {
|
||||
@@ -94,7 +97,7 @@ class BookPageInfos : RealmObject {
|
||||
|
||||
|
||||
}
|
||||
class BookPageInfo : RealmObject {
|
||||
class ContentsPageInfo : RealmObject {
|
||||
|
||||
var chapterID : Int = 0
|
||||
var contents : String? = ""
|
||||
@@ -104,6 +107,7 @@ class BookPageInfo : RealmObject {
|
||||
var bookTitle : String? = ""
|
||||
var chapterNum : Int = 0
|
||||
var lastPage : Int? = 0
|
||||
var contentsType : String? = ""
|
||||
|
||||
fun isValidBook() = (pathUrl?.length ?: 0) > 1
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package bums.lunatic.launcher.tokiz.data.model
|
||||
class FakeSessions : ArrayList<FakeSession>{
|
||||
constructor(initialCapacity: Int) : super(initialCapacity)
|
||||
constructor() : super()
|
||||
constructor(c: MutableCollection<out FakeSession>) : super(c)
|
||||
}
|
||||
data class FakeSession (val scrolldata: ScrollData, val history: History )
|
||||
data class ScrollData(
|
||||
val scroll: String,
|
||||
val zoom: Zoom
|
||||
)
|
||||
|
||||
data class Zoom(
|
||||
val resolution: Int,
|
||||
val displaySize: DisplaySize
|
||||
)
|
||||
|
||||
data class DisplaySize(
|
||||
val height: Int,
|
||||
val width: Int
|
||||
)
|
||||
|
||||
data class History(
|
||||
val entries: List<HistoryEntry>,
|
||||
val requestedIndex: Int,
|
||||
val fromIdx: Int,
|
||||
val index: Int
|
||||
)
|
||||
|
||||
data class HistoryEntry(
|
||||
val persist: Boolean,
|
||||
val cacheKey: Int,
|
||||
val ID: Int,
|
||||
val url: String,
|
||||
val title: String,
|
||||
val loadReplace: Boolean,
|
||||
val docIdentifier: Long,
|
||||
val loadReplace2: Boolean,
|
||||
val partitionedPrincipalToInherit_base64: Map<String, Map<String, String>>,
|
||||
val triggeringPrincipal_base64: Map<String, Map<String, String>>,
|
||||
val principalToInherit_base64: Map<String, Map<String, String>>,
|
||||
val resultPrincipalURI: String,
|
||||
val hasUserInteraction: Boolean,
|
||||
val originalURI: String,
|
||||
val docshellUUID: String
|
||||
)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package bums.lunatic.launcher.tokiz.data.model
|
||||
|
||||
import android.content.pm.ActivityInfo
|
||||
import bums.lunatic.launcher.tokiz.data.model.LastInfo
|
||||
import io.realm.kotlin.types.RealmObject
|
||||
import io.realm.kotlin.types.annotations.PrimaryKey
|
||||
import java.text.SimpleDateFormat
|
||||
@@ -9,12 +10,17 @@ import java.util.Date
|
||||
|
||||
class LastInfo : RealmObject {
|
||||
@PrimaryKey
|
||||
var _id : String = "UniqLastId"
|
||||
var _id : String = ""
|
||||
var pageUrl : String = ""
|
||||
var title : String = ""
|
||||
var chapter : Int = 0
|
||||
var pageIndex : Int = 0
|
||||
var contentsName : String = ""
|
||||
var contentsType : String? = ""
|
||||
set(value) {
|
||||
_id = value ?: ""
|
||||
field = value
|
||||
}
|
||||
var displayOrientation : Int = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
||||
|
||||
fun makeHistoryItem() : HistoryItem = HistoryItem().apply {
|
||||
@@ -24,6 +30,7 @@ class LastInfo : RealmObject {
|
||||
pageIndex = this@LastInfo.pageIndex
|
||||
contentsName = this@LastInfo.contentsName
|
||||
displayOrientation = this@LastInfo.displayOrientation
|
||||
contentsType = this@LastInfo.contentsType
|
||||
}
|
||||
}
|
||||
class HistoryItem : RealmObject {
|
||||
@@ -34,6 +41,7 @@ class HistoryItem : RealmObject {
|
||||
var pageIndex : Int = 0
|
||||
var contentsName : String = ""
|
||||
var displayOrientation : Int = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
||||
var contentsType : String? = ""
|
||||
|
||||
fun makeLastInfo() = LastInfo().apply{
|
||||
_id = "UniqLastId"
|
||||
@@ -43,13 +51,15 @@ class HistoryItem : RealmObject {
|
||||
pageIndex = this@HistoryItem.pageIndex
|
||||
contentsName = this@HistoryItem.contentsName
|
||||
displayOrientation = this@HistoryItem.displayOrientation
|
||||
contentsType = this@HistoryItem.contentsType
|
||||
}
|
||||
fun putHistory(bookPageInfo: BookPageInfo? , currentPath : String) : HistoryItem {
|
||||
title = bookPageInfo?.bookTitle ?: SimpleDateFormat("YY-mm-DD-HH:mm").format(Date())
|
||||
pageUrl = bookPageInfo?.pathUrl ?: currentPath
|
||||
chapter = bookPageInfo?.chapterNum ?: 0
|
||||
pageIndex = bookPageInfo?.lastPage ?: 0
|
||||
contentsName = bookPageInfo?.chapterTitle ?: ""
|
||||
fun putHistory(contentsPageInfo: ContentsPageInfo?, currentPath : String) : HistoryItem {
|
||||
title = contentsPageInfo?.bookTitle ?: SimpleDateFormat("YY-mm-DD-HH:mm").format(Date())
|
||||
pageUrl = contentsPageInfo?.pathUrl ?: currentPath
|
||||
chapter = contentsPageInfo?.chapterNum ?: 0
|
||||
pageIndex = contentsPageInfo?.lastPage ?: 0
|
||||
contentsName = contentsPageInfo?.chapterTitle ?: ""
|
||||
contentsType = contentsPageInfo?.contentsType ?: ""
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.widget.ArrayAdapter
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import bums.lunatic.launcher.tokiz.data.model.BookPageInfo
|
||||
import bums.lunatic.launcher.tokiz.data.model.ContentsPageInfo
|
||||
|
||||
object DefaultList {
|
||||
fun showDefaultList(context: Context, title : String, items : Collection<BookPageInfo>, firstPosition : Int, choosedTitle : (Int)->String, chooedPositive : (Int)->Unit, saveCalback : (Int)->Unit ) {
|
||||
fun showDefaultList(context: Context, title : String, items : Collection<ContentsPageInfo>, firstPosition : Int, choosedTitle : (Int)->String, chooedPositive : (Int)->Unit, saveCalback : (Int)->Unit ) {
|
||||
val builderSingle: AlertDialog.Builder = AlertDialog.Builder(context)
|
||||
builderSingle.setTitle(title)
|
||||
val arrayAdapter =
|
||||
|
||||
@@ -2,12 +2,13 @@ package bums.lunatic.launcher.tokiz.view
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.util.AttributeSet
|
||||
import android.view.MotionEvent
|
||||
import android.view.PointerIcon
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import bums.lunatic.launcher.tokiz.common.TouchArea
|
||||
import bums.lunatic.launcher.tokiz.webcontents.contentsinfo.BooktokiStruct
|
||||
import bums.lunatic.launcher.utils.Blog
|
||||
import bums.lunatic.launcher.utils.SimpleFingerGestures
|
||||
import org.mozilla.geckoview.GeckoView
|
||||
@@ -23,23 +24,37 @@ typealias JxInteface = (JxEvent)->Unit
|
||||
open class BWebview : GeckoView {
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
constructor(context: Context?) : super(context) {
|
||||
this.setOnTouchListener { v,e ->
|
||||
if (e.device.name.contains("JX-12",true) == true) {
|
||||
return@setOnTouchListener mSimpleFingerGestures.onTouch(v,e)
|
||||
this.setOnTouchListener { v, event ->
|
||||
if (event.device.name?.contains(
|
||||
"JX-12",
|
||||
true
|
||||
) == true || event.device.name?.equals("J06", true) == true
|
||||
) {
|
||||
return@setOnTouchListener mSimpleFingerGestures.onTouch(v, event)
|
||||
} else {
|
||||
return@setOnTouchListener super.onTouchEvent(e)
|
||||
return@setOnTouchListener super.onTouchEvent(event)
|
||||
}
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
val nullCursor = PointerIcon.getSystemIcon(context!!, PointerIcon.TYPE_NULL)
|
||||
this.setPointerIcon(nullCursor)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {
|
||||
this.setOnTouchListener { v,e ->
|
||||
if (e.device.name.contains("JX-12",true) == true) {
|
||||
return@setOnTouchListener mSimpleFingerGestures.onTouch(v,e)
|
||||
this.setOnTouchListener { v,event ->
|
||||
if (event.device.name?.contains("JX-12",true) == true|| event.device.name?.equals("J06",true) == true) {
|
||||
return@setOnTouchListener mSimpleFingerGestures.onTouch(v,event)
|
||||
} else {
|
||||
return@setOnTouchListener super.onTouchEvent(e)
|
||||
return@setOnTouchListener super.onTouchEvent(event)
|
||||
}
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
val nullCursor = PointerIcon.getSystemIcon(context!!, PointerIcon.TYPE_NULL)
|
||||
this.setPointerIcon(nullCursor)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +111,7 @@ open class BWebview : GeckoView {
|
||||
gestureDistance: Double
|
||||
): Boolean {
|
||||
Blog.LOGE("onPinch")
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onUnpinch(
|
||||
@@ -122,7 +137,7 @@ open class BWebview : GeckoView {
|
||||
fingers: Int
|
||||
): Boolean {
|
||||
Blog.LOGE("onLongPress")
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onClick(
|
||||
@@ -131,7 +146,7 @@ open class BWebview : GeckoView {
|
||||
): Boolean {
|
||||
Blog.LOGE("onClick")
|
||||
jxInteface?.invoke(JxEvent.ON_CLICK)
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +157,7 @@ open class BWebview : GeckoView {
|
||||
|
||||
var jxInteface : JxInteface? = null
|
||||
|
||||
|
||||
var lastDomain : String = ""
|
||||
|
||||
fun loadUrl(url: String) {
|
||||
if (this.isVisible == false) {
|
||||
@@ -151,7 +166,7 @@ open class BWebview : GeckoView {
|
||||
Blog.LOGE("url >>>> ${url}")
|
||||
var nUrl = url
|
||||
if (url.startsWith("http") == false) {
|
||||
nUrl = BooktokiStruct.getLastedDoamin().plus(url)
|
||||
nUrl = lastDomain
|
||||
}
|
||||
nUrl?.let { url ->
|
||||
if (url.split("//").size > 1) {
|
||||
@@ -171,7 +186,7 @@ open class BWebview : GeckoView {
|
||||
|
||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||
Blog.LOGE("event.device.name >>> ${event.device.name}")
|
||||
if (event.device.name.contains("JX-12", true)) {
|
||||
if (event.device.name?.contains("JX-12",true) == true || event.device.name?.equals("J06",true) == true) {
|
||||
Blog.LOGE("BWebview onTouchEvent $event")
|
||||
when (event.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
|
||||
@@ -243,8 +243,8 @@ class PagedTextLayout : ConstraintLayout , PagedTextGenerateInterface {
|
||||
}
|
||||
|
||||
fun setPageBy(num : Int) {
|
||||
currentPage = num
|
||||
var realPage = if(isDualPage()) currentPage * 2 else currentPage
|
||||
this@PagedTextLayout.currentPage = num
|
||||
var realPage = if(isDualPage()) this@PagedTextLayout.currentPage * 2 else this@PagedTextLayout.currentPage
|
||||
Blog.LOGE("realPage = if(${pageList?.size} ?: 0 > ${realPage}) { realPage} else { ${(pageList?.size ?: 0) - 1 }}")
|
||||
realPage = if(pageList?.size ?: 0 > realPage) { realPage} else { (pageList?.size ?: 0) - 1 }
|
||||
currentPageTextView?.text = "${realPage + 1 }/${ pageList?.size ?: 0 + 1}"
|
||||
@@ -260,25 +260,25 @@ class PagedTextLayout : ConstraintLayout , PagedTextGenerateInterface {
|
||||
|
||||
fun size(): Int = if(isDualPage()) Math.round((hiddenTextView?.size() ?:0) * 0.5f) else hiddenTextView?.size() ?: 0
|
||||
fun getFastPageCount() = if(isDualPage()) 3 else 6
|
||||
fun current(): Int = currentPage
|
||||
fun current(): Int = this@PagedTextLayout.currentPage
|
||||
fun doNext(fast : Boolean = false) {
|
||||
if (fast) {
|
||||
setPageBy(if((currentPage + getFastPageCount()) >= 0) {
|
||||
currentPage + getFastPageCount()
|
||||
setPageBy(if((this@PagedTextLayout.currentPage + getFastPageCount()) >= 0) {
|
||||
this@PagedTextLayout.currentPage + getFastPageCount()
|
||||
} else {size()})
|
||||
} else {
|
||||
setPageBy(currentPage.inc())
|
||||
setPageBy(this@PagedTextLayout.currentPage.inc())
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun doPrev(fast : Boolean = false) {
|
||||
if (fast) {
|
||||
setPageBy(if((currentPage - getFastPageCount()) >= 0) {
|
||||
currentPage - getFastPageCount()
|
||||
setPageBy(if((this@PagedTextLayout.currentPage - getFastPageCount()) >= 0) {
|
||||
this@PagedTextLayout.currentPage - getFastPageCount()
|
||||
} else {0})
|
||||
} else {
|
||||
setPageBy(if(currentPage > 0 )currentPage.dec() else 0)
|
||||
setPageBy(if(this@PagedTextLayout.currentPage > 0 ) this@PagedTextLayout.currentPage.dec() else 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
-16
@@ -1,16 +1,16 @@
|
||||
package bums.lunatic.launcher.tokiz.webcontents.contentsinfo
|
||||
|
||||
|
||||
object BooktokiStruct : BaseWebContents() {
|
||||
|
||||
override var lastNumber : Int = 468
|
||||
|
||||
override fun getWebcontentsName(): String {
|
||||
return "Booktoki"
|
||||
}
|
||||
|
||||
override fun getLastedDoamin(): String {
|
||||
return String.format("https://booktoki%d.com", lastNumber)
|
||||
}
|
||||
|
||||
}
|
||||
//package bums.lunatic.launcher.tokiz.webcontents.contentsinfo
|
||||
//
|
||||
//
|
||||
//object BooktokiStruct : BaseWebContents() {
|
||||
//
|
||||
// override var lastNumber : Int = 468
|
||||
//
|
||||
// override fun getWebcontentsName(): String {
|
||||
// return "Booktoki"
|
||||
// }
|
||||
//
|
||||
// override fun getLastedDoamin(): String {
|
||||
// return String.format("https://booktoki%d.com", lastNumber)
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -2,8 +2,8 @@ package bums.lunatic.launcher.workers
|
||||
|
||||
import bums.lunatic.launcher.BuildConfig
|
||||
import bums.lunatic.launcher.apps.SimpleContact
|
||||
import bums.lunatic.launcher.tokiz.data.model.BookPageInfo
|
||||
import bums.lunatic.launcher.tokiz.data.model.BookPageInfos
|
||||
import bums.lunatic.launcher.tokiz.data.model.ContentsPageInfo
|
||||
import bums.lunatic.launcher.tokiz.data.model.ContentsCollection
|
||||
import bums.lunatic.launcher.tokiz.data.model.HistoryItem
|
||||
import bums.lunatic.launcher.tokiz.data.model.LastInfo
|
||||
import bums.lunatic.launcher.tokiz.data.model.ReaderConfig
|
||||
@@ -56,21 +56,12 @@ class CustMigration : AutomaticSchemaMigration {
|
||||
}
|
||||
object WorkersDb {
|
||||
|
||||
fun recommendApps() {
|
||||
val cal = Calendar.getInstance()
|
||||
cal.time = Date()
|
||||
val weekOfYear = cal.get(Calendar.WEEK_OF_YEAR)
|
||||
val weekOfMonth = cal.get(Calendar.WEEK_OF_MONTH)
|
||||
val dayOfWeek = cal.get(Calendar.DAY_OF_WEEK)
|
||||
getRealm().apply {
|
||||
// this.query<UserActionModel>().query("weekOfYear == $0 OR weekOfMonth == $1 OR dayOfWeek == $2").limit()
|
||||
}
|
||||
}
|
||||
|
||||
val clazz : Set<KClass<out BaseRealmObject>> = setOf(RssData::class, NotificationItem::class, AppInfo::class,SimpleContact::class, RecentCall::class, RecentSms::class, CurrentPlayItem::class,
|
||||
TelegramBotUpdate::class, TelegramData::class, TelegramMessage::class, TelegramChat::class, BotCommandEentitie::class, TelegramFrom::class,
|
||||
WeatherForcast::class, Location::class, Current::class, Forecast::class, Condition::class, Forecastday::class, Day::class, Astro::class, Hour::class,
|
||||
LocationLog::class,
|
||||
LastInfo::class, HistoryItem::class, ReaderConfig::class, BookPageInfos::class, BookPageInfo::class
|
||||
LastInfo::class, HistoryItem::class, ReaderConfig::class, ContentsCollection::class, ContentsPageInfo::class
|
||||
)
|
||||
//,UserActionModel::class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user