This commit is contained in:
lunaticbum 2025-07-19 10:54:22 +09:00
parent a00b2764b0
commit b5ad079439
25 changed files with 5442 additions and 1575 deletions

View File

@ -79,11 +79,12 @@
android:requestLegacyExternalStorage="true" android:requestLegacyExternalStorage="true"
> >
<!-- android:excludeFromRecents="true"--> <!-- android:excludeFromRecents="true"-->
<!-- portrait|reversePortrait|userPortrait|sensorPortrait-->
<activity <activity
android:name=".LauncherActivity" android:name=".LauncherActivity"
android:theme="@style/Theme.LunarLauncher.Starting" android:theme="@style/Theme.LunarLauncher.Starting"
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:screenOrientation="userPortrait"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|screenLayout|layoutDirection" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|screenLayout|layoutDirection"
android:windowSoftInputMode="adjustResize" android:windowSoftInputMode="adjustResize"
android:exported="true"> android:exported="true">
@ -99,54 +100,54 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <!-- <activity-->
android:name=".apps.AppDrawer" <!-- android:name=".apps.AppDrawer"-->
android:label="@string/lunar_settings" <!-- android:label="@string/lunar_settings"-->
android:launchMode="singleTask" <!-- android:launchMode="singleTask"-->
android:excludeFromRecents="true" <!-- android:excludeFromRecents="true"-->
android:exported="true"> <!-- android:exported="true">-->
<intent-filter> <!-- <intent-filter>-->
<action android:name="android.intent.action.APPLICATION_PREFERENCES" /> <!-- <action android:name="android.intent.action.APPLICATION_PREFERENCES" />-->
</intent-filter> <!-- </intent-filter>-->
</activity> <!-- </activity>-->
<activity <!-- <activity-->
android:name=".tokiz.Settings" <!-- android:name=".tokiz.Settings"-->
android:label="@string/lunar_settings" <!-- android:label="@string/lunar_settings"-->
android:launchMode="singleInstance" <!-- android:launchMode="singleInstance"-->
android:excludeFromRecents="true" <!-- android:excludeFromRecents="true"-->
android:exported="true"> <!-- android:exported="true">-->
</activity> <!-- </activity>-->
<activity <!-- <activity-->
android:name=".settings.SettingsActivity" <!-- android:name=".settings.SettingsActivity"-->
android:label="@string/lunar_settings" <!-- android:label="@string/lunar_settings"-->
android:launchMode="singleTask" <!-- android:launchMode="singleTask"-->
android:excludeFromRecents="true" <!-- android:excludeFromRecents="true"-->
android:exported="true"> <!-- android:exported="true">-->
<intent-filter> <!-- <intent-filter>-->
<action android:name="android.intent.action.APPLICATION_PREFERENCES" /> <!-- <action android:name="android.intent.action.APPLICATION_PREFERENCES" />-->
</intent-filter> <!-- </intent-filter>-->
</activity> <!-- </activity>-->
<activity <!-- <activity-->
android:name=".behavior.Behavior" <!-- android:name=".behavior.Behavior"-->
android:label="@string/lunar_settings" <!-- android:label="@string/lunar_settings"-->
android:launchMode="singleTask" <!-- android:launchMode="singleTask"-->
android:excludeFromRecents="true" <!-- android:excludeFromRecents="true"-->
android:exported="true"> <!-- android:exported="true">-->
<intent-filter> <!-- <intent-filter>-->
<action android:name="android.intent.action.APPLICATION_PREFERENCES" /> <!-- <action android:name="android.intent.action.APPLICATION_PREFERENCES" />-->
</intent-filter> <!-- </intent-filter>-->
</activity> <!-- </activity>-->
<receiver android:name=".helpers.HeadsetActionButtonReceiver" <!-- <receiver android:name=".helpers.HeadsetActionButtonReceiver"-->
android:enabled="true" <!-- android:enabled="true"-->
android:exported="true" > <!-- android:exported="true" >-->
<intent-filter <!-- <intent-filter-->
android:priority="2147483647"> <!-- android:priority="2147483647">-->
<action android:name="android.intent.action.MEDIA_BUTTON"/> <!-- <action android:name="android.intent.action.MEDIA_BUTTON"/>-->
</intent-filter> <!-- </intent-filter>-->
</receiver> <!-- </receiver>-->
<!-- <service android:name=".MediaButtonService"--> <!-- <service android:name=".MediaButtonService"-->
<!-- android:exported="true">--> <!-- android:exported="true">-->
@ -161,52 +162,52 @@
android:permission="android.permission.BIND_JOB_SERVICE" android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="false"/> android:exported="false"/>
<service <!-- <service-->
android:name=".helpers.LockService" <!-- android:name=".helpers.LockService"-->
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE" <!-- android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"-->
android:exported="false"> <!-- android:exported="false">-->
<intent-filter> <!-- <intent-filter>-->
<action android:name="android.accessibilityservice.AccessibilityService" /> <!-- <action android:name="android.accessibilityservice.AccessibilityService" />-->
</intent-filter> <!-- </intent-filter>-->
<meta-data <!-- <meta-data-->
android:name="android.accessibilityservice" <!-- android:name="android.accessibilityservice"-->
android:resource="@xml/lock_service" /> <!-- android:resource="@xml/lock_service" />-->
</service> <!-- </service>-->
<receiver <!-- <receiver-->
android:name=".helpers.AdminReceiver" <!-- android:name=".helpers.AdminReceiver"-->
android:label="@string/app_name" <!-- android:label="@string/app_name"-->
android:description="@string/device_admin_description" <!-- android:description="@string/device_admin_description"-->
android:permission="android.permission.BIND_DEVICE_ADMIN" <!-- android:permission="android.permission.BIND_DEVICE_ADMIN"-->
android:exported="false"> <!-- android:exported="false">-->
<meta-data <!-- <meta-data-->
android:name="android.app.device_admin" <!-- android:name="android.app.device_admin"-->
android:resource="@xml/device_admin" /> <!-- android:resource="@xml/device_admin" />-->
<intent-filter> <!-- <intent-filter>-->
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" /> <!-- <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />-->
</intent-filter> <!-- </intent-filter>-->
</receiver> <!-- </receiver>-->
<activity <!-- <activity-->
android:name=".home.RssViewerActivity" <!-- android:name=".home.RssViewerActivity"-->
android:configChanges="keyboardHidden|orientation|screenSize" <!-- android:configChanges="keyboardHidden|orientation|screenSize"-->
android:hardwareAccelerated="true" <!-- android:hardwareAccelerated="true"-->
android:launchMode="singleTask" <!-- android:launchMode="singleTask"-->
android:exported="true" <!-- android:exported="true"-->
android:excludeFromRecents="true" <!-- android:excludeFromRecents="true"-->
android:theme="@style/FinestWebViewTheme.Fullscreen" > <!-- android:theme="@style/FinestWebViewTheme.Fullscreen" >-->
<intent-filter> <!-- <intent-filter>-->
<action android:name="android.intent.action.VIEW" /> <!-- <action android:name="android.intent.action.VIEW" />-->
<category android:name="android.intent.category.DEFAULT" /> <!-- <category android:name="android.intent.category.DEFAULT" />-->
<data android:scheme="file"/> <!-- <data android:scheme="file"/>-->
<data android:scheme="content"/> <!-- <data android:scheme="content"/>-->
<data android:mimeType="text/html"/> <!-- <data android:mimeType="text/html"/>-->
<data android:mimeType="text/plain"/> <!-- <data android:mimeType="text/plain"/>-->
<data android:mimeType="text/xml"/> <!-- <data android:mimeType="text/xml"/>-->
<data android:mimeType="application/xhtml+xml"/> <!-- <data android:mimeType="application/xhtml+xml"/>-->
<data android:mimeType="application/vnd.wap.xhtml+xml"/> <!-- <data android:mimeType="application/vnd.wap.xhtml+xml"/>-->
</intent-filter> <!-- </intent-filter>-->
</activity> <!-- </activity>-->
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
@ -218,55 +219,55 @@
android:name="android.support.FILE_PROVIDER_PATHS" android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" /> android:resource="@xml/file_paths" />
</provider> </provider>
<service android:name=".receiver.NLService" <!-- <service android:name=".receiver.NLService"-->
android:label="@string/app_name" <!-- android:label="@string/app_name"-->
android:enabled="true" <!-- android:enabled="true"-->
android:exported="true" <!-- android:exported="true"-->
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"> <!-- android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">-->
<intent-filter> <!-- <intent-filter>-->
<action android:name="android.service.notification.NotificationListenerService" /> <!-- <action android:name="android.service.notification.NotificationListenerService" />-->
</intent-filter> <!-- </intent-filter>-->
</service> <!-- </service>-->
<service android:name="bums.lunatic.launcher.workers.LocationUpdateService" /> <!-- <service android:name="bums.lunatic.launcher.workers.LocationUpdateService" />-->
<receiver android:name=".LauncherActivity$EndCallReceiver" <!-- <receiver android:name=".LauncherActivity$EndCallReceiver"-->
android:enabled="true" <!-- android:enabled="true"-->
android:exported="true"> <!-- android:exported="true">-->
<intent-filter> <!-- <intent-filter>-->
<action android:name="android.intent.action.PHONE_STATE" /> <!-- <action android:name="android.intent.action.PHONE_STATE" />-->
</intent-filter> <!-- </intent-filter>-->
</receiver> <!-- </receiver>-->
<receiver android:name=".LauncherActivity$SMSReceiver" <!-- <receiver android:name=".LauncherActivity$SMSReceiver"-->
android:exported="true" <!-- android:exported="true"-->
android:enabled="true" <!-- android:enabled="true"-->
android:permission="android.permission.BROADCAST_SMS"> <!-- android:permission="android.permission.BROADCAST_SMS">-->
<intent-filter> <!-- <intent-filter>-->
<action android:name="android.provider.Telephony.SMS_RECEIVED" /> <!-- <action android:name="android.provider.Telephony.SMS_RECEIVED" />-->
<action android:name="android.provider.Telephony.MMS_RECEIVED" /> <!-- <action android:name="android.provider.Telephony.MMS_RECEIVED" />-->
</intent-filter> <!-- </intent-filter>-->
</receiver> <!-- </receiver>-->
<receiver <!-- <receiver-->
android:exported="true" <!-- android:exported="true"-->
android:enabled="true" <!-- android:enabled="true"-->
android:name=".receiver.PackageEventReceiver" <!-- android:name=".receiver.PackageEventReceiver"-->
> <!-- >-->
<intent-filter> <!-- <intent-filter>-->
<action android:name="android.intent.action.PACKAGE_REPLACED"/> <!-- <action android:name="android.intent.action.PACKAGE_REPLACED"/>-->
<action android:name="android.intent.action.PACKAGE_INSTALL"/> <!-- <action android:name="android.intent.action.PACKAGE_INSTALL"/>-->
<action android:name="android.intent.action.PACKAGE_ADDED"/> <!-- <action android:name="android.intent.action.PACKAGE_ADDED"/>-->
<action android:name="android.intent.action.PACKAGE_CHANGED"/> <!-- <action android:name="android.intent.action.PACKAGE_CHANGED"/>-->
<action android:name="android.intent.action.PACKAGE_DATA_CLEARED"/> <!-- <action android:name="android.intent.action.PACKAGE_DATA_CLEARED"/>-->
<action android:name="android.intent.action.PACKAGE_FIRST_LAUNCH"/> <!-- <action android:name="android.intent.action.PACKAGE_FIRST_LAUNCH"/>-->
<action android:name="android.intent.action.PACKAGE_FULLY_REMOVED"/> <!-- <action android:name="android.intent.action.PACKAGE_FULLY_REMOVED"/>-->
<action android:name="android.intent.action.PACKAGE_INSTALL"/> <!-- <action android:name="android.intent.action.PACKAGE_INSTALL"/>-->
<action android:name="android.intent.action.PACKAGE_NEEDS_VERIFICATION"/> <!-- <action android:name="android.intent.action.PACKAGE_NEEDS_VERIFICATION"/>-->
<action android:name="android.intent.action.PACKAGE_REMOVED"/> <!-- <action android:name="android.intent.action.PACKAGE_REMOVED"/>-->
<action android:name="android.intent.action.PACKAGE_REPLACED"/> <!-- <action android:name="android.intent.action.PACKAGE_REPLACED"/>-->
<action android:name="android.intent.action.PACKAGE_RESTARTED"/> <!-- <action android:name="android.intent.action.PACKAGE_RESTARTED"/>-->
<action android:name="android.intent.action.PACKAGE_VERIFIED"/> <!-- <action android:name="android.intent.action.PACKAGE_VERIFIED"/>-->
<data android:scheme="package" /> <!-- <data android:scheme="package" />-->
</intent-filter> <!-- </intent-filter>-->
</receiver> <!-- </receiver>-->
</application> </application>
</manifest> </manifest>

File diff suppressed because one or more lines are too long

View File

@ -45,20 +45,62 @@ port.onMessage.addListener(response => {
else scrollByPercentUpDown(Number(isUpDown),100); else scrollByPercentUpDown(Number(isUpDown),100);
} }
break; break;
case "ViewerTouch": {
if (document.querySelector(".show_viewer")) {
var area = response["area"]
var current = Number(document.querySelector("#mcv_currentPageNum").innerHTML)
var total = Number(document.querySelector("#mcv_totalPagesNum").innerHTML)
if ("left" === area) {
if (current > 0) {
document.querySelector("#mcv_clickAreaRight").click()
} else {
document.querySelector("#goPrevBtn").click()
}
} else if ("right" === area) {
if (current < total) {
document.querySelector("#mcv_clickAreaLeft").click()
}else {
document.querySelector("#goNextBtn").click()
}
}
}
}
break;
case "onLoaded":{ case "onLoaded":{
} }
break; break;
case "saveContent":{
sendMessage(
{
type: "SHOWVIEWER",
contents : document.documentElement.outerHTML
}
);
}
default: default:
port.postMessage(`Received: ${JSON.stringify(response)}`); port.postMessage(`Received: ${JSON.stringify(response)}`);
break break
} }
}); });
if(document.querySelector(".list-body")) { if (document.location.href.search("reddit") > -1) {
if (document.querySelector('#xpromo-bottom-sheet')) {
document.querySelector('#xpromo-bottom-sheet').remove()
}
}
if (document.querySelector(".show_viewer") !== null) {
document.querySelector(".show_viewer").click();
sendMessage({type: "SHOWVIEWER"});
}
if(document.querySelector(".list-body") !== null) {
var listBody = null var listBody = null
try {listBody = document.querySelector(".list-body");}catch (e) {} try {listBody = document.querySelector(".list-body");}catch (e) {}
getList(listBody.children) getList(listBody.children)
} else if(document.querySelector("#novel_content")){ }
if(document.querySelector("#novel_content") !== null){
var title = null var title = null
var contents = null var contents = null
try {title = toonTitle(document.querySelector(".page-desc")); }catch (e) {} try {title = toonTitle(document.querySelector(".page-desc")); }catch (e) {}
@ -74,16 +116,18 @@ if(document.querySelector(".list-body")) {
} }
); );
} }
} else if(document.querySelector("#html_encoder_div")) { }
if(document.querySelector("#html_encoder_div")) {
sendMessage( sendMessage(
{ {
type: "WebtoonContents", type: "WebtoonContents",
} }
); );
} else {
sendMessage({type:"MSG",msg:"connected has Nothings"});
loadComplete()
} }
// else {
// sendMessage({type:"MSG",msg:"connected has Nothings"});
// loadComplete()
// }
function getList(children) { function getList(children) {
@ -93,9 +137,29 @@ function getList(children) {
for (i= 0; i < maxCount; i++) { for (i= 0; i < maxCount; i++) {
var chapterNum = children[i].getElementsByClassName('wr-num')[0].textContent; var chapterNum = children[i].getElementsByClassName('wr-num')[0].textContent;
var pageUrl = children[i].getElementsByClassName('wr-subject')[0].getElementsByTagName('a')[0].href; var pageUrl = children[i].getElementsByClassName('wr-subject')[0].getElementsByTagName('a')[0].href;
var contentsType = location.hostname.search("book") > -1 ? "book" : location.hostname.search("mana") > -1 ? "comics" : location.hostname.search("new") > -1 ? "webtoon" : "web";
if (pageUrl != null && pageUrl.length > 0 && pageUrl.startsWith("http")) { if (pageUrl != null && pageUrl.length > 0 && pageUrl.startsWith("http")) {
pageUrl = new URL(pageUrl).pathname; var urlObj =URL.parse(pageUrl);
pageUrl = urlObj.protocol + '//' + urlObj.host + urlObj.pathname;
if (pageUrl) {
var paths = pageUrl.split('/')
if (paths.length > 0) {
var last = paths[paths.length - 1];
if (last && Array.from(last).every(ch => ch >= '0' && ch <= '9')) {
} else {
paths.pop();
}
}
var newP = paths.join('/');
pageUrl = URL.parse(newP).pathname
}
} else {
console.log("pageUrl.startsWith('http') == false" + pageUrl);
} }
var chapterTitle = children[i].getElementsByClassName('wr-subject')[0].getElementsByTagName('a')[0].innerText; var chapterTitle = children[i].getElementsByClassName('wr-subject')[0].getElementsByTagName('a')[0].innerText;
if(chapterTitle.split('\n').length > 1) { if(chapterTitle.split('\n').length > 1) {
chapterTitle = chapterTitle.split('\n')[1]; chapterTitle = chapterTitle.split('\n')[1];
@ -107,6 +171,7 @@ function getList(children) {
'chapterID': Number(chapterNum), 'chapterID': Number(chapterNum),
'chapterNum': Number(chapterNum), 'chapterNum': Number(chapterNum),
'pathUrl': pageUrl, 'pathUrl': pageUrl,
'contentsType': contentsType,
'bookPageUrl': bookPageUrl, 'bookPageUrl': bookPageUrl,
'chapterTitle': chapterTitle, 'chapterTitle': chapterTitle,
'bookTitle': bookTitle, 'bookTitle': bookTitle,
@ -121,6 +186,7 @@ function getList(children) {
{ {
type: "getListResult", type: "getListResult",
bookInfos: { bookInfos: {
'contentsType': contentsType,
bookTitle: bookTitle, bookTitle: bookTitle,
bookPageUrl: new URL(location.href).pathname, bookPageUrl: new URL(location.href).pathname,
pages: contentsArray , pages: contentsArray ,
@ -150,7 +216,7 @@ function scrollByPercent(current , max) {
const moveAmount = pageHeight / max; const moveAmount = pageHeight / max;
window.scrollTo({ top: moveAmount * current, behavior: "smooth" }); window.scrollTo({ top: moveAmount * current, behavior: "smooth" });
} }
document.querySelector(".header__inner")
function scrollByPercentUpDown(isToDown , max) { function scrollByPercentUpDown(isToDown , max) {
const pageHeight = Math.max( const pageHeight = Math.max(
document.body.scrollHeight, document.body.scrollHeight,
@ -161,7 +227,7 @@ function scrollByPercentUpDown(isToDown , max) {
document.documentElement.clientHeight document.documentElement.clientHeight
); );
const currentScroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; const currentScroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
const moveAmount = Math.max(pageHeight / max,100); const moveAmount = Math.max(pageHeight / max,150);
window.scrollTo({ top: currentScroll + (moveAmount * isToDown) , behavior: "smooth" }); window.scrollTo({ top: currentScroll + (moveAmount * isToDown) , behavior: "smooth" });
} }
@ -172,6 +238,11 @@ function sendMessage(msg) {
port.postMessage(JSON.stringify(msg)); port.postMessage(JSON.stringify(msg));
} }
function toast(msg) {
port.postMessage(JSON.stringify({type:"MSG",msg:msg}));
}
function dssd() { function dssd() {
} }

View File

@ -82,6 +82,8 @@ import bums.lunatic.launcher.home.RssViewBuilder
import bums.lunatic.launcher.model.RssData import bums.lunatic.launcher.model.RssData
import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.receiver.NLService 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.Blog
import bums.lunatic.launcher.utils.FeedParseManager import bums.lunatic.launcher.utils.FeedParseManager
import bums.lunatic.launcher.utils.getJ import bums.lunatic.launcher.utils.getJ
@ -307,9 +309,10 @@ internal class LauncherActivity : CommonActivity() {
var onExit = false var onExit = false
var lastAction = MotionEvent.ACTION_HOVER_EXIT var lastAction = MotionEvent.ACTION_HOVER_EXIT
override fun dispatchKeyEvent(ev: KeyEvent): Boolean { override fun dispatchKeyEvent(ev: KeyEvent): Boolean {
Blog.LOGE("dispatch ev?.device?.name >>> ${ev?.device?.name}") val currentFragment = supportFragmentManager.findFragmentById(R.id.fragment_container)
if (ev?.device?.name?.contains("SM-031N Mouse") == true) { Blog.LOGE("dispatch ev?.device?.name >>> ${ev?.device?.name} , keyCode >> ${ev?.keyCode}")
if (ev?.device?.name?.contains("SM-031N Mouse") == true) {
when(ev.action) { when(ev.action) {
ACTION_UP -> { ACTION_UP -> {
Blog.LOGE("dispatch dispatchKeyEvent>>> ${ev}") Blog.LOGE("dispatch dispatchKeyEvent>>> ${ev}")
@ -384,26 +387,42 @@ internal class LauncherActivity : CommonActivity() {
} }
else { else {
if(MotionEvent.ACTION_UP.equals(ev?.action ?: MotionEvent.ACTION_CANCEL) == true) { if(MotionEvent.ACTION_UP.equals(ev?.action ?: MotionEvent.ACTION_CANCEL) == true) {
when (ev.keyCode) { return when (ev.keyCode) {
KeyEvent.KEYCODE_VOLUME_DOWN -> { KeyEvent.KEYCODE_VOLUME_DOWN -> {
if(currentFragment is Novels){ currentFragment.actionNextEvent() }
novels?.actionNextEvent() true
return true
} }
KeyEvent.KEYCODE_VOLUME_UP -> { KeyEvent.KEYCODE_VOLUME_UP -> {
novels?.actionPrevEvent() if(currentFragment is Novels){ currentFragment.actionPrevEvent() }
return true true
} }
else -> return false else -> false
} }
} else { } else {
return false return when (ev.keyCode) {
KeyEvent.KEYCODE_VOLUME_DOWN -> {
true
}
KeyEvent.KEYCODE_VOLUME_UP -> {
true
}
else -> false
}
} }
} }
return super.dispatchKeyEvent(ev) 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() { fun onClickCenterButton() {
@ -545,11 +564,7 @@ internal class LauncherActivity : CommonActivity() {
"android.intent.extra.EXTRA_START_REASON" "android.intent.extra.EXTRA_START_REASON"
).equals("startDockOrHome") ).equals("startDockOrHome")
) { ) {
if (binding.home.visibility == View.VISIBLE) {
switchAppDrawer()
} else {
}
} else { } else {
intent?.extras?.keySet()?.forEach { intent?.extras?.keySet()?.forEach {
try { try {
@ -576,8 +591,8 @@ internal class LauncherActivity : CommonActivity() {
// } // }
super.onNewIntent(intent) super.onNewIntent(intent)
} }
var home : LauncherHome? = null
var novels : Novels? = null
@SuppressLint("NewApi", "MissingPermission") @SuppressLint("NewApi", "MissingPermission")
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen() installSplashScreen()
@ -599,74 +614,40 @@ internal class LauncherActivity : CommonActivity() {
binding.tabs.setOnCheckedChangeListener { g, id -> binding.tabs.setOnCheckedChangeListener { g, id ->
when(id) { showContents(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 -> {}
}
} }
/* handle navigation back events */ /* handle navigation back events */
handleBackPress() 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() 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() { private fun initGeckoRuntime() {
if (sRuntime == null) { if (sRuntime == null) {
try { try {
@ -697,14 +678,14 @@ internal class LauncherActivity : CommonActivity() {
super.onDestroy() super.onDestroy()
} }
var blutoothManager : BluetoothManager? = null // var blutoothManager : BluetoothManager? = null
override fun onStart() { override fun onStart() {
super.onStart() super.onStart()
blutoothManager = BluetoothManager(this) // blutoothManager = BluetoothManager(this)
blutoothManager?.register() // blutoothManager?.register()
blutoothManager?.initBluetoothAdapter() // blutoothManager?.initBluetoothAdapter()
blutoothManager?.blueToothState() // blutoothManager?.blueToothState()
blutoothManager?.getPairedDevices() // blutoothManager?.getPairedDevices()
statusBarView() statusBarView()
setBgColor() setBgColor()
} }
@ -713,7 +694,7 @@ internal class LauncherActivity : CommonActivity() {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
refreshFeeds() refreshFeeds()
blutoothManager?.getPairedDevices() // blutoothManager?.getPairedDevices()
Blog.LOGE("LauncherActivity onResume") Blog.LOGE("LauncherActivity onResume")
} }
@ -760,11 +741,17 @@ internal class LauncherActivity : CommonActivity() {
private fun handleBackPress() { private fun handleBackPress() {
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) { onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() { override fun handleOnBackPressed() {
if (binding.booktoki.isVisible) { val currentFragment = supportFragmentManager.findFragmentById(R.id.fragment_container)
finish() when(currentFragment) {
} else { is LauncherHome ->{
finish() currentFragment.doNextPage()
}
} }
// if (binding.ho.isVisible) {
// finish()
// } else {
// finish()
// }
} }
}) })
} }

View File

@ -1,6 +1,8 @@
package bums.lunatic.launcher.home package bums.lunatic.launcher.home
import android.content.Context import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.os.Message 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_BUTTON_Y
import android.view.KeyEvent.KEYCODE_DPAD_DOWN import android.view.KeyEvent.KEYCODE_DPAD_DOWN
import android.view.KeyEvent.KEYCODE_DPAD_UP import android.view.KeyEvent.KEYCODE_DPAD_UP
import android.widget.ProgressBar
import bums.lunatic.launcher.LauncherActivity.Companion.getRuntime import bums.lunatic.launcher.LauncherActivity.Companion.getRuntime
import bums.lunatic.launcher.tokiz.view.BWebview import bums.lunatic.launcher.tokiz.view.BWebview
import bums.lunatic.launcher.tokiz.view.JxEvent import bums.lunatic.launcher.tokiz.view.JxEvent
@ -47,7 +50,7 @@ class GeckoWeb : BWebview {
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) { constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {
buildWeb() buildWeb()
} }
var progress : ProgressBar? = null
val mPortNam = "browser" val mPortNam = "browser"
val extPath = "resource://android/assets/extensions/my_extension/" val extPath = "resource://android/assets/extensions/my_extension/"
val extId = "messaging@booktoki468.com" val extId = "messaging@booktoki468.com"
@ -168,7 +171,7 @@ class GeckoWeb : BWebview {
session: GeckoSession, session: GeckoSession,
mediaSession: MediaSession mediaSession: MediaSession
) { ) {
Blog.LOGE("onPlay") Blog.LOGE("onPlay $mediaSession")
super.onPlay(session, mediaSession) super.onPlay(session, mediaSession)
} }
@ -184,7 +187,7 @@ class GeckoWeb : BWebview {
session: GeckoSession, session: GeckoSession,
mediaSession: MediaSession mediaSession: MediaSession
) { ) {
Blog.LOGE("onStop") Blog.LOGE("onStop $mediaSession")
super.onStop(session, mediaSession) super.onStop(session, mediaSession)
} }
@ -275,8 +278,21 @@ class GeckoWeb : BWebview {
super.onSessionStateChange(session, sessionState) 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) { override fun onPageStart(session: GeckoSession, url: String) {
super.onPageStart(session, url) 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) { override fun onPageStop(session: GeckoSession, success: Boolean) {
@ -325,6 +341,7 @@ class GeckoWeb : BWebview {
// url이 현재 로드된 주소입니다. // url이 현재 로드된 주소입니다.
Blog.LOGE("GeckoView", "현재 주소: $url") Blog.LOGE("GeckoView", "현재 주소: $url")
Blog.LOGE("GeckoView", "현재 session: $session") Blog.LOGE("GeckoView", "현재 session: $session")
url?.let { url -> url?.let { url ->
if (url.split("//").size > 1) { if (url.split("//").size > 1) {
url.replace("//", "/").replace("https:/", "https://").let { url.replace("//", "/").replace("https:/", "https://").let {

View File

@ -25,6 +25,7 @@ import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.PointerIcon
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.Toast import android.widget.Toast
@ -261,7 +262,7 @@ internal class LauncherHome : Fragment() {
binding.infoList.visibility = View.VISIBLE binding.infoList.visibility = View.VISIBLE
binding.infoList.adapter = mRssAdapter binding.infoList.adapter = mRssAdapter
binding.infoList.setOnTouchListener { v,e -> 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}") Blog.LOGE("touchEvent -> ${e}")
return@setOnTouchListener mSimpleFingerGestures.onTouch(v,e) return@setOnTouchListener mSimpleFingerGestures.onTouch(v,e)
} else { } else {
@ -270,6 +271,7 @@ internal class LauncherHome : Fragment() {
} }
} }
queryInfos() queryInfos()
binding.geckoWeb.progress = binding.progressBar
binding.geckoWeb.jxInteface = { jxEvent -> binding.geckoWeb.jxInteface = { jxEvent ->
when(jxEvent) { when(jxEvent) {
JxEvent.SCROLL_UP -> binding.geckoWeb.sendScrollDown(false) 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 return binding.root
} }
@ -336,7 +341,7 @@ internal class LauncherHome : Fragment() {
delete( delete(
query<RssData>() query<RssData>()
.query("pubDate < $0", beforeDay(30)) .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() .query("vote != $0", true).find()
) )
} }
@ -369,7 +374,7 @@ internal class LauncherHome : Fragment() {
beforeQuery() beforeQuery()
var rQ = WorkersDb.getRealm().query<RssData>().query("read < $0", nomoreShowCount).distinct("originPage", "title") var rQ = WorkersDb.getRealm().query<RssData>().query("read < $0", nomoreShowCount).distinct("originPage", "title")
if (!noLimit) rQ.query("pubDate > $0", beforeOneDay()) 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) updateQuery(rQ)
} }

View File

@ -116,7 +116,7 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
private val swipeTime = 300 // 스와이프 최대 시간(ms) private val swipeTime = 300 // 스와이프 최대 시간(ms)
private val clickThreshold = 30 // 클릭으로 인정할 최대 이동 거리(px) private val clickThreshold = 30 // 클릭으로 인정할 최대 이동 거리(px)
override fun onTouch(v: View?, event: MotionEvent): Boolean { 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) { when (event.action) {
MotionEvent.ACTION_DOWN -> { MotionEvent.ACTION_DOWN -> {
startX = event.x startX = event.x

View File

@ -220,7 +220,7 @@ internal class RssItemAdapter (
event: MotionEvent event: MotionEvent
): Boolean { ): Boolean {
Blog.LOGE("event.device.name >>> ${event.device.name}") 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) return true//mSimpleFingerGestures.onTouch(v,event)
} else { } else {
return false return false

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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() {
}
}

View File

@ -2,7 +2,6 @@ package bums.lunatic.launcher.tokiz.common
import android.content.Context import android.content.Context
import android.content.SharedPreferences import android.content.SharedPreferences
import bums.lunatic.launcher.tokiz.webcontents.contentsinfo.BooktokiStruct
import bums.lunatic.launcher.utils.Blog import bums.lunatic.launcher.utils.Blog
object PrefManager { object PrefManager {
@ -20,9 +19,9 @@ object PrefManager {
return main.getString(key, "") return main.getString(key, "")
} }
fun getLastDomain() : String { // fun getLastDomain() : String {
return main.getString(domainKey, BooktokiStruct.getLastedDoamin()) ?: BooktokiStruct.getLastedDoamin() // return main.getString(domainKey, BooktokiStruct.getLastedDoamin()) ?: BooktokiStruct.getLastedDoamin()
} // }
fun putLastDomain(domain : String) { fun putLastDomain(domain : String) {
Blog.LOGE("domain >>> ${domain}") Blog.LOGE("domain >>> ${domain}")
main.edit().putString(domainKey,domain).apply() main.edit().putString(domainKey,domain).apply()

View File

@ -1,7 +1,7 @@
package bums.lunatic.launcher.tokiz.data package bums.lunatic.launcher.tokiz.data
import bums.lunatic.launcher.tokiz.data.model.BookPageInfo import bums.lunatic.launcher.tokiz.data.model.ContentsPageInfo
import bums.lunatic.launcher.tokiz.data.model.BookPageInfos import bums.lunatic.launcher.tokiz.data.model.ContentsCollection
import bums.lunatic.launcher.tokiz.data.model.HistoryItem import bums.lunatic.launcher.tokiz.data.model.HistoryItem
import bums.lunatic.launcher.tokiz.data.model.LastInfo import bums.lunatic.launcher.tokiz.data.model.LastInfo
import bums.lunatic.launcher.tokiz.data.model.ReaderConfig 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 var url : String = aUrl
Blog.LOGE("aUrl >>> ${aUrl}") Blog.LOGE("aUrl >>> ${aUrl} , contentsType ${contentsType}")
openRealm.apply{ openRealm.apply{
if (url.startsWith("//")) { if (url.startsWith("//")) {
while (url.startsWith("//")) { while (url.startsWith("//")) {
@ -55,15 +55,17 @@ object HistoryManager {
} }
} }
Blog.LOGE("aUrl >>> ${url}") Blog.LOGE("aUrl >>> ${url}")
var bookPageInfo = this.query(BookPageInfo::class).query("pathUrl == $0 || bookPageUrl == $0","${url}").find() var contentsPageInfo = this.query(ContentsPageInfo::class).query("contentsType == $0", contentsType).query("pathUrl == $0 || bookPageUrl == $0","${url}").find()
if (bookPageInfo != null && bookPageInfo.count() > 0) { if (contentsPageInfo != null && contentsPageInfo.count() > 0) {
Blog.LOGE("get ${bookPageInfo}" ) Blog.LOGE("get ${contentsPageInfo}" )
var pgs = this.query(BookPageInfos::class,"bookPageUrl == $0", bookPageInfo.first().bookPageUrl).find() var pgs = this.query(ContentsCollection::class,"bookPageUrl == $0", contentsPageInfo.first().bookPageUrl).find()
if (pgs.size > 0) { if (pgs.size > 0) {
pgs.first().let { pgs.first().let {
Blog.LOGE("get ${it} , ${it?.pages}") Blog.LOGE("get ${it} , ${it?.pages}")
callback.invoke(this.copyFromRealm(it)) callback.invoke(this.copyFromRealm(it))
} }
} else {
callback.invoke(null)
} }
} else { } else {
callback.invoke(null) 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 var url : String = aUrl
openRealm.apply{ openRealm.apply{
if (url.startsWith("//")) { if (url.startsWith("//")) {
@ -79,7 +81,7 @@ object HistoryManager {
url = url.replace("//","/").trim() 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) { if (result.size > 0) {
var bookPageInfo = result?.first() var bookPageInfo = result?.first()
if (bookPageInfo != null) { 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 var url : String = aUrl
openRealm.writeBlocking { openRealm.writeBlocking {
if (url.startsWith("//")) { if (url.startsWith("//")) {
@ -101,7 +103,7 @@ object HistoryManager {
url = url.replace("//","/").trim() 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) { if (result.size > 0) {
var bookPageInfo = result?.first() var bookPageInfo = result?.first()
if (bookPageInfo != null) { 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("////")) { var url : String = if (aUrl.startsWith("//") || aUrl.startsWith("///") || aUrl.startsWith("////")) {
aUrl.replace("////","/").replace("///","/").replace("//","/") aUrl.replace("////","/").replace("///","/").replace("//","/")
} else aUrl } else aUrl
openRealm.writeBlocking { openRealm.writeBlocking {
Blog.LOGE("getBooPageInfoContentsSave ${url}") 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) { if (result.size > 0) {
result.first().contents = contents result.first().contents = contents
copyToRealm(result.first(), UpdatePolicy.ALL) 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 var url : String = aUrl
openRealm.apply{ openRealm.apply{
if (url.startsWith("//")) { if (url.startsWith("//")) {
@ -136,11 +138,11 @@ object HistoryManager {
url = url.replace("//","/").trim() url = url.replace("//","/").trim()
} }
} }
var bookPageInfo = var contentsPageInfo =
this.query(BookPageInfo::class).query("pathUrl == $0", url).find() this.query(ContentsPageInfo::class).query("contentsType == $0", contentsType).query("pathUrl == $0", url).find()
if (bookPageInfo.size > 0) { if (contentsPageInfo.size > 0) {
Blog.LOGE("getNextPage 2 => chapterNum : ${bookPageInfo.first().chapterNum} , bookPageInfo.bookPageUrl : ${bookPageInfo.first().bookPageUrl}" ) Blog.LOGE("getNextPage 2 => chapterNum : ${contentsPageInfo.first().chapterNum} , bookPageInfo.bookPageUrl : ${contentsPageInfo.first().bookPageUrl}" )
var results = this.query(BookPageInfo::class).query("chapterNum == $0",bookPageInfo.first().chapterNum + 1).query("bookPageUrl == $0","${bookPageInfo.first().bookPageUrl}").find() var results = this.query(ContentsPageInfo::class).query("chapterNum == $0",contentsPageInfo.first().chapterNum + 1).query("bookPageUrl == $0","${contentsPageInfo.first().bookPageUrl}").find()
if(results.size > 0) { if(results.size > 0) {
results.first().let { results.first().let {
Blog.LOGE("getNextPage 2 nextBook pathUrl : ${it.pathUrl}" ) 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 var url : String = aUrl
openRealm.apply{ openRealm.apply{
Blog.LOGE("getPrevPage ${url}" ) Blog.LOGE("getPrevPage ${url}" )
@ -162,13 +164,13 @@ object HistoryManager {
} }
} }
Blog.LOGE("getPrevPage ${url}" ) Blog.LOGE("getPrevPage ${url}" )
var bookPageInfo = var contentsPageInfo =
this.query(BookPageInfo::class).query("pathUrl == $0", url).find() this.query(ContentsPageInfo::class).query("contentsType == $0", contentsType).query("pathUrl == $0", url).find()
Blog.LOGE("getPrevPage ${bookPageInfo}" ) Blog.LOGE("getPrevPage ${contentsPageInfo}" )
if (bookPageInfo.size > 0) { if (contentsPageInfo.size > 0) {
Blog.LOGE("getPrevPage 2 ${bookPageInfo?.first()?.chapterNum}" ) Blog.LOGE("getPrevPage 2 ${contentsPageInfo?.first()?.chapterNum}" )
Blog.LOGE("getPrevPage 2 ${bookPageInfo?.first()?.bookPageUrl}" ) Blog.LOGE("getPrevPage 2 ${contentsPageInfo?.first()?.bookPageUrl}" )
var results = this.query(BookPageInfo::class).query("chapterNum == $0",bookPageInfo.first().chapterNum - 1).query("bookPageUrl == $0","${bookPageInfo.first().bookPageUrl}").find() var results = this.query(ContentsPageInfo::class).query("chapterNum == $0",contentsPageInfo.first().chapterNum - 1).query("bookPageUrl == $0","${contentsPageInfo.first().bookPageUrl}").find()
if(results.size > 0) { if(results.size > 0) {
results.first()?.let { results.first()?.let {
Blog.LOGE("getPrevPage 2 ${it.bookPageUrl}" ) Blog.LOGE("getPrevPage 2 ${it.bookPageUrl}" )

View File

@ -7,7 +7,7 @@ import io.realm.kotlin.types.annotations.PrimaryKey
class PortMessage { class PortMessage {
var type : String? = "" var type : String? = ""
var bookInfos : BookPageInfosJ? = null var bookInfos : PageInfosJ? = null
var book : BookContents? = null var book : BookContents? = null
var msg : String? = null var msg : String? = null
} }
@ -16,11 +16,11 @@ class BookContents {
var bookContents : String? = null var bookContents : String? = null
} }
class BookPageInfosJ { class PageInfosJ {
var bookTitle : String = "" var bookTitle : String = ""
var bookPageUrl : String = "" var bookPageUrl : String = ""
var contentsType : String? = ""
var pages : ArrayList<BookPageInfoJ> = arrayListOf<BookPageInfoJ>() var pages : ArrayList<PageInfoJ> = arrayListOf<PageInfoJ>()
fun getTitleArray() : ArrayList<String> { fun getTitleArray() : ArrayList<String> {
var arrayList = ArrayList<String>() var arrayList = ArrayList<String>()
@ -28,15 +28,16 @@ class BookPageInfosJ {
return arrayList return arrayList
} }
fun getR() : BookPageInfos{ fun getR() : ContentsCollection{
var r = BookPageInfos() var r = ContentsCollection()
r.bookTitle = this.bookTitle r.bookTitle = this.bookTitle
r.bookPageUrl = this.bookPageUrl r.bookPageUrl = this.bookPageUrl
r.contentsType = this.contentsType
return r return r
} }
} }
class BookPageInfoJ {
class PageInfoJ {
var chapterID : Int = 0 var chapterID : Int = 0
var contents : String? = "" var contents : String? = ""
var bookPageUrl : String? = "" var bookPageUrl : String? = ""
@ -45,9 +46,10 @@ class BookPageInfoJ {
var chapterNum : Int = 0 var chapterNum : Int = 0
var lastPage : Int? = 0 var lastPage : Int? = 0
var pathUrl : String? = "" var pathUrl : String? = ""
var contentsType : String? = ""
fun getRealm() : BookPageInfo { fun getRealm() : ContentsPageInfo {
var r = BookPageInfo() var r = ContentsPageInfo()
r.chapterID = this.chapterID r.chapterID = this.chapterID
r.contents = this.contents r.contents = this.contents
r.bookPageUrl = this.bookPageUrl ?: "" r.bookPageUrl = this.bookPageUrl ?: ""
@ -56,19 +58,20 @@ class BookPageInfoJ {
r.chapterNum = this.chapterNum r.chapterNum = this.chapterNum
r.lastPage = this.lastPage r.lastPage = this.lastPage
r.pathUrl = this.pathUrl?.replace("'","") r.pathUrl = this.pathUrl?.replace("'","")
r.contentsType = this.contentsType
return r return r
} }
} }
class BookPageInfos : RealmObject { class ContentsCollection : RealmObject {
var bookTitle : String = "" var bookTitle : String = ""
@PrimaryKey @PrimaryKey
var bookPageUrl : String? = "" var bookPageUrl : String? = ""
var pages : RealmList<BookPageInfo> = realmListOf() var pages : RealmList<ContentsPageInfo> = realmListOf()
var contentsType : String? = ""
fun getTitleArray() : ArrayList<String> { fun getTitleArray() : ArrayList<String> {
var arrayList = ArrayList<String>() var arrayList = ArrayList<String>()
@ -78,11 +81,11 @@ class BookPageInfos : RealmObject {
} }
fun sort() { fun sort() {
val comparator : Comparator<BookPageInfo> = compareBy { it.chapterID } val comparator : Comparator<ContentsPageInfo> = compareBy { it.chapterID }
pages.sortWith(comparator) pages.sortWith(comparator)
} }
fun hasItem(item: BookPageInfo) : Boolean { fun hasItem(item: ContentsPageInfo) : Boolean {
var hasItem = false var hasItem = false
for (c in pages) { for (c in pages) {
if (!hasItem) { if (!hasItem) {
@ -94,7 +97,7 @@ class BookPageInfos : RealmObject {
} }
class BookPageInfo : RealmObject { class ContentsPageInfo : RealmObject {
var chapterID : Int = 0 var chapterID : Int = 0
var contents : String? = "" var contents : String? = ""
@ -104,6 +107,7 @@ class BookPageInfo : RealmObject {
var bookTitle : String? = "" var bookTitle : String? = ""
var chapterNum : Int = 0 var chapterNum : Int = 0
var lastPage : Int? = 0 var lastPage : Int? = 0
var contentsType : String? = ""
fun isValidBook() = (pathUrl?.length ?: 0) > 1 fun isValidBook() = (pathUrl?.length ?: 0) > 1

View File

@ -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
)

View File

@ -1,6 +1,7 @@
package bums.lunatic.launcher.tokiz.data.model package bums.lunatic.launcher.tokiz.data.model
import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo
import bums.lunatic.launcher.tokiz.data.model.LastInfo
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 java.text.SimpleDateFormat import java.text.SimpleDateFormat
@ -9,12 +10,17 @@ import java.util.Date
class LastInfo : RealmObject { class LastInfo : RealmObject {
@PrimaryKey @PrimaryKey
var _id : String = "UniqLastId" var _id : String = ""
var pageUrl : String = "" var pageUrl : String = ""
var title : String = "" var title : String = ""
var chapter : Int = 0 var chapter : Int = 0
var pageIndex : Int = 0 var pageIndex : Int = 0
var contentsName : String = "" var contentsName : String = ""
var contentsType : String? = ""
set(value) {
_id = value ?: ""
field = value
}
var displayOrientation : Int = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT var displayOrientation : Int = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
fun makeHistoryItem() : HistoryItem = HistoryItem().apply { fun makeHistoryItem() : HistoryItem = HistoryItem().apply {
@ -24,6 +30,7 @@ class LastInfo : RealmObject {
pageIndex = this@LastInfo.pageIndex pageIndex = this@LastInfo.pageIndex
contentsName = this@LastInfo.contentsName contentsName = this@LastInfo.contentsName
displayOrientation = this@LastInfo.displayOrientation displayOrientation = this@LastInfo.displayOrientation
contentsType = this@LastInfo.contentsType
} }
} }
class HistoryItem : RealmObject { class HistoryItem : RealmObject {
@ -34,6 +41,7 @@ class HistoryItem : RealmObject {
var pageIndex : Int = 0 var pageIndex : Int = 0
var contentsName : String = "" var contentsName : String = ""
var displayOrientation : Int = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT var displayOrientation : Int = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
var contentsType : String? = ""
fun makeLastInfo() = LastInfo().apply{ fun makeLastInfo() = LastInfo().apply{
_id = "UniqLastId" _id = "UniqLastId"
@ -43,13 +51,15 @@ class HistoryItem : RealmObject {
pageIndex = this@HistoryItem.pageIndex pageIndex = this@HistoryItem.pageIndex
contentsName = this@HistoryItem.contentsName contentsName = this@HistoryItem.contentsName
displayOrientation = this@HistoryItem.displayOrientation displayOrientation = this@HistoryItem.displayOrientation
contentsType = this@HistoryItem.contentsType
} }
fun putHistory(bookPageInfo: BookPageInfo? , currentPath : String) : HistoryItem { fun putHistory(contentsPageInfo: ContentsPageInfo?, currentPath : String) : HistoryItem {
title = bookPageInfo?.bookTitle ?: SimpleDateFormat("YY-mm-DD-HH:mm").format(Date()) title = contentsPageInfo?.bookTitle ?: SimpleDateFormat("YY-mm-DD-HH:mm").format(Date())
pageUrl = bookPageInfo?.pathUrl ?: currentPath pageUrl = contentsPageInfo?.pathUrl ?: currentPath
chapter = bookPageInfo?.chapterNum ?: 0 chapter = contentsPageInfo?.chapterNum ?: 0
pageIndex = bookPageInfo?.lastPage ?: 0 pageIndex = contentsPageInfo?.lastPage ?: 0
contentsName = bookPageInfo?.chapterTitle ?: "" contentsName = contentsPageInfo?.chapterTitle ?: ""
contentsType = contentsPageInfo?.contentsType ?: ""
return this return this
} }
} }

View File

@ -5,10 +5,10 @@ import android.content.Context
import android.content.DialogInterface import android.content.DialogInterface
import android.widget.ArrayAdapter import android.widget.ArrayAdapter
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import bums.lunatic.launcher.tokiz.data.model.BookPageInfo import bums.lunatic.launcher.tokiz.data.model.ContentsPageInfo
object DefaultList { 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) val builderSingle: AlertDialog.Builder = AlertDialog.Builder(context)
builderSingle.setTitle(title) builderSingle.setTitle(title)
val arrayAdapter = val arrayAdapter =

View File

@ -2,12 +2,13 @@ package bums.lunatic.launcher.tokiz.view
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.os.Build
import android.util.AttributeSet import android.util.AttributeSet
import android.view.MotionEvent import android.view.MotionEvent
import android.view.PointerIcon
import android.view.View import android.view.View
import androidx.core.view.isVisible import androidx.core.view.isVisible
import bums.lunatic.launcher.tokiz.common.TouchArea 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.Blog
import bums.lunatic.launcher.utils.SimpleFingerGestures import bums.lunatic.launcher.utils.SimpleFingerGestures
import org.mozilla.geckoview.GeckoView import org.mozilla.geckoview.GeckoView
@ -23,23 +24,37 @@ typealias JxInteface = (JxEvent)->Unit
open class BWebview : GeckoView { open class BWebview : GeckoView {
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
constructor(context: Context?) : super(context) { constructor(context: Context?) : super(context) {
this.setOnTouchListener { v,e -> this.setOnTouchListener { v, event ->
if (e.device.name.contains("JX-12",true) == true) { if (event.device.name?.contains(
return@setOnTouchListener mSimpleFingerGestures.onTouch(v,e) "JX-12",
true
) == true || event.device.name?.equals("J06", true) == true
) {
return@setOnTouchListener mSimpleFingerGestures.onTouch(v, event)
} else { } 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") @SuppressLint("ClickableViewAccessibility")
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) { constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {
this.setOnTouchListener { v,e -> this.setOnTouchListener { v,event ->
if (e.device.name.contains("JX-12",true) == true) { if (event.device.name?.contains("JX-12",true) == true|| event.device.name?.equals("J06",true) == true) {
return@setOnTouchListener mSimpleFingerGestures.onTouch(v,e) return@setOnTouchListener mSimpleFingerGestures.onTouch(v,event)
} else { } 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 gestureDistance: Double
): Boolean { ): Boolean {
Blog.LOGE("onPinch") Blog.LOGE("onPinch")
return false return true
} }
override fun onUnpinch( override fun onUnpinch(
@ -122,7 +137,7 @@ open class BWebview : GeckoView {
fingers: Int fingers: Int
): Boolean { ): Boolean {
Blog.LOGE("onLongPress") Blog.LOGE("onLongPress")
return false return true
} }
override fun onClick( override fun onClick(
@ -131,7 +146,7 @@ open class BWebview : GeckoView {
): Boolean { ): Boolean {
Blog.LOGE("onClick") Blog.LOGE("onClick")
jxInteface?.invoke(JxEvent.ON_CLICK) jxInteface?.invoke(JxEvent.ON_CLICK)
return false return true
} }
@ -142,7 +157,7 @@ open class BWebview : GeckoView {
var jxInteface : JxInteface? = null var jxInteface : JxInteface? = null
var lastDomain : String = ""
fun loadUrl(url: String) { fun loadUrl(url: String) {
if (this.isVisible == false) { if (this.isVisible == false) {
@ -151,7 +166,7 @@ open class BWebview : GeckoView {
Blog.LOGE("url >>>> ${url}") Blog.LOGE("url >>>> ${url}")
var nUrl = url var nUrl = url
if (url.startsWith("http") == false) { if (url.startsWith("http") == false) {
nUrl = BooktokiStruct.getLastedDoamin().plus(url) nUrl = lastDomain
} }
nUrl?.let { url -> nUrl?.let { url ->
if (url.split("//").size > 1) { if (url.split("//").size > 1) {
@ -171,7 +186,7 @@ open class BWebview : GeckoView {
override fun onTouchEvent(event: MotionEvent): Boolean { override fun onTouchEvent(event: MotionEvent): Boolean {
Blog.LOGE("event.device.name >>> ${event.device.name}") 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") Blog.LOGE("BWebview onTouchEvent $event")
when (event.action) { when (event.action) {
MotionEvent.ACTION_DOWN -> { MotionEvent.ACTION_DOWN -> {

View File

@ -243,8 +243,8 @@ class PagedTextLayout : ConstraintLayout , PagedTextGenerateInterface {
} }
fun setPageBy(num : Int) { fun setPageBy(num : Int) {
currentPage = num this@PagedTextLayout.currentPage = num
var realPage = if(isDualPage()) currentPage * 2 else currentPage 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 }}") 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 } realPage = if(pageList?.size ?: 0 > realPage) { realPage} else { (pageList?.size ?: 0) - 1 }
currentPageTextView?.text = "${realPage + 1 }/${ 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 size(): Int = if(isDualPage()) Math.round((hiddenTextView?.size() ?:0) * 0.5f) else hiddenTextView?.size() ?: 0
fun getFastPageCount() = if(isDualPage()) 3 else 6 fun getFastPageCount() = if(isDualPage()) 3 else 6
fun current(): Int = currentPage fun current(): Int = this@PagedTextLayout.currentPage
fun doNext(fast : Boolean = false) { fun doNext(fast : Boolean = false) {
if (fast) { if (fast) {
setPageBy(if((currentPage + getFastPageCount()) >= 0) { setPageBy(if((this@PagedTextLayout.currentPage + getFastPageCount()) >= 0) {
currentPage + getFastPageCount() this@PagedTextLayout.currentPage + getFastPageCount()
} else {size()}) } else {size()})
} else { } else {
setPageBy(currentPage.inc()) setPageBy(this@PagedTextLayout.currentPage.inc())
} }
} }
fun doPrev(fast : Boolean = false) { fun doPrev(fast : Boolean = false) {
if (fast) { if (fast) {
setPageBy(if((currentPage - getFastPageCount()) >= 0) { setPageBy(if((this@PagedTextLayout.currentPage - getFastPageCount()) >= 0) {
currentPage - getFastPageCount() this@PagedTextLayout.currentPage - getFastPageCount()
} else {0}) } else {0})
} else { } else {
setPageBy(if(currentPage > 0 )currentPage.dec() else 0) setPageBy(if(this@PagedTextLayout.currentPage > 0 ) this@PagedTextLayout.currentPage.dec() else 0)
} }
} }

View File

@ -1,16 +1,16 @@
package bums.lunatic.launcher.tokiz.webcontents.contentsinfo //package bums.lunatic.launcher.tokiz.webcontents.contentsinfo
//
//
object BooktokiStruct : BaseWebContents() { //object BooktokiStruct : BaseWebContents() {
//
override var lastNumber : Int = 468 // override var lastNumber : Int = 468
//
override fun getWebcontentsName(): String { // override fun getWebcontentsName(): String {
return "Booktoki" // return "Booktoki"
} // }
//
override fun getLastedDoamin(): String { // override fun getLastedDoamin(): String {
return String.format("https://booktoki%d.com", lastNumber) // return String.format("https://booktoki%d.com", lastNumber)
} // }
//
} //}

View File

@ -2,8 +2,8 @@ package bums.lunatic.launcher.workers
import bums.lunatic.launcher.BuildConfig import bums.lunatic.launcher.BuildConfig
import bums.lunatic.launcher.apps.SimpleContact import bums.lunatic.launcher.apps.SimpleContact
import bums.lunatic.launcher.tokiz.data.model.BookPageInfo import bums.lunatic.launcher.tokiz.data.model.ContentsPageInfo
import bums.lunatic.launcher.tokiz.data.model.BookPageInfos import bums.lunatic.launcher.tokiz.data.model.ContentsCollection
import bums.lunatic.launcher.tokiz.data.model.HistoryItem import bums.lunatic.launcher.tokiz.data.model.HistoryItem
import bums.lunatic.launcher.tokiz.data.model.LastInfo import bums.lunatic.launcher.tokiz.data.model.LastInfo
import bums.lunatic.launcher.tokiz.data.model.ReaderConfig import bums.lunatic.launcher.tokiz.data.model.ReaderConfig
@ -56,21 +56,12 @@ class CustMigration : AutomaticSchemaMigration {
} }
object WorkersDb { 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, 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, 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, WeatherForcast::class, Location::class, Current::class, Forecast::class, Condition::class, Forecastday::class, Day::class, Astro::class, Hour::class,
LocationLog::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 //,UserActionModel::class

View File

@ -1,25 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout> <layout>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:id="@+id/intro_bg"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".activity.Intro"> >
<!-- <WebView-->
<!-- android:id="@+id/hidden_web"-->
<!-- android:layout_margin="60dp"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"/>-->
<bums.lunatic.launcher.tokiz.view.BWebview <bums.lunatic.launcher.tokiz.view.BWebview
android:id="@+id/menu_web" android:id="@+id/menu_web"
@ -31,9 +18,6 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/textview_title" /> app:layout_constraintTop_toBottomOf="@id/textview_title" />
<androidx.constraintlayout.utils.widget.ImageFilterButton <androidx.constraintlayout.utils.widget.ImageFilterButton
android:id="@+id/btn_home" android:id="@+id/btn_home"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -73,21 +57,6 @@
app:layout_constraintHorizontal_chainStyle="spread_inside" app:layout_constraintHorizontal_chainStyle="spread_inside"
/> />
<!-- <androidx.constraintlayout.utils.widget.ImageFilterButton-->
<!-- android:id="@+id/btn_rotate"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="@dimen/main_top_height"-->
<!-- android:adjustViewBounds="true"-->
<!-- android:scaleType="centerInside"-->
<!-- android:visibility="gone"-->
<!-- android:src="@drawable/rotation"-->
<!-- android:background="#8FFF"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- app:layout_constraintLeft_toRightOf="@id/btn_list"-->
<!-- app:layout_constraintRight_toLeftOf="@+id/btn_history"-->
<!-- app:layout_constraintHorizontal_chainStyle="spread_inside"-->
<!-- />-->
<androidx.constraintlayout.utils.widget.ImageFilterButton <androidx.constraintlayout.utils.widget.ImageFilterButton
android:id="@+id/btn_history" android:id="@+id/btn_history"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -147,7 +116,5 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>

View File

@ -9,27 +9,18 @@
android:id="@+id/mainFragmentsContainer" android:id="@+id/mainFragmentsContainer"
> >
<FrameLayout
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment_container"
android:visibility="visible"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@drawable/base_bg"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toTopOf="@id/tabs" app:layout_constraintBottom_toTopOf="@id/tabs"/>
android:layout_width="0dp"
android:layout_height="0dp">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/home"
android:visibility="visible"
android:name="bums.lunatic.launcher.home.LauncherHome"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<androidx.fragment.app.FragmentContainerView
android:id="@+id/booktoki"
android:visibility="gone"
android:name="bums.lunatic.launcher.tokiz.Novels"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
<RadioGroup <RadioGroup
android:id="@+id/tabs" android:id="@+id/tabs"
@ -52,7 +43,27 @@
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatRadioButton <androidx.appcompat.widget.AppCompatRadioButton
android:text="booktoki" android:text="booktoki"
android:id="@+id/book" android:id="@+id/books"
android:button="@null"
android:gravity="center"
android:layout_weight="1"
android:background="@color/tabs_black"
android:textColor="@color/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatRadioButton
android:text="newtoki"
android:id="@+id/webtoons"
android:button="@null"
android:gravity="center"
android:layout_weight="1"
android:background="@color/tabs_black"
android:textColor="@color/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatRadioButton
android:text="manatoki"
android:id="@+id/comics"
android:button="@null" android:button="@null"
android:gravity="center" android:gravity="center"
android:layout_weight="1" android:layout_weight="1"

View File

@ -23,11 +23,23 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
/> />
<bums.lunatic.launcher.home.GeckoWeb <bums.lunatic.launcher.home.GeckoWeb
android:id="@+id/geckoWeb" android:id="@+id/geckoWeb"
android:visibility="gone" android:visibility="gone"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
/> />
<ProgressBar
app:layout_constraintTop_toTopOf="@id/geckoWeb"
app:layout_constraintLeft_toLeftOf="@id/geckoWeb"
app:layout_constraintRight_toRightOf="@id/geckoWeb"
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_height="4dp"
android:max="100"
android:progress="0"
android:visibility="visible"
android:indeterminate="false"/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>