From 2719b7d291ba8b04f903fc3d845a6ef4a009942b Mon Sep 17 00:00:00 2001 From: lunaticbum Date: Wed, 23 Jul 2025 10:43:45 +0900 Subject: [PATCH] . --- .../extensions/my_extension/messaging.js | 4 +- .../bums/lunatic/launcher/LauncherActivity.kt | 23 +- .../lunatic/launcher/feeds/rss/RssAdapter.kt | 11 - .../bums/lunatic/launcher/home/ExtHahMap.java | 31 ++ .../lunatic/launcher/home/LauncherHome.kt | 14 +- .../launcher/home/adapters/RssTagAdapter.kt | 237 ++++++++------- .../bums/lunatic/launcher/model/Adults.kt | 272 +++++++++--------- .../launcher/model/RssDataInterface.kt | 20 +- .../bums/lunatic/launcher/tokiz/BaseToki.kt | 8 + .../bums/lunatic/launcher/utils/JsoupUtils.kt | 97 ++++--- .../lunatic/launcher/workers/ArcaGetter.kt | 33 ++- .../lunatic/launcher/workers/BaseGetter.kt | 2 +- .../lunatic/launcher/workers/ClienGetter.kt | 2 + .../bums/lunatic/launcher/workers/DCGetter.kt | 2 + .../lunatic/launcher/workers/DotaxGetter.kt | 3 + .../lunatic/launcher/workers/FmKoreaGetter.kt | 4 +- .../lunatic/launcher/workers/RuliWebGetter.kt | 10 +- 17 files changed, 414 insertions(+), 359 deletions(-) create mode 100644 app/src/main/kotlin/bums/lunatic/launcher/home/ExtHahMap.java diff --git a/app/src/main/assets/extensions/my_extension/messaging.js b/app/src/main/assets/extensions/my_extension/messaging.js index 75f01190..38b0ebc4 100644 --- a/app/src/main/assets/extensions/my_extension/messaging.js +++ b/app/src/main/assets/extensions/my_extension/messaging.js @@ -208,7 +208,7 @@ function scrollByPercent(current , max) { document.documentElement.clientHeight ); - const currentScroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; + const currentScroll = window.scrollY || document.documentElement.scrollTop || document.body.scrollTop || 0; const moveAmount = pageHeight / max; window.scrollTo({ top: moveAmount * current, behavior: "smooth" }); } @@ -222,7 +222,7 @@ function scrollByPercentUpDown(isToDown , max) { document.body.clientHeight, document.documentElement.clientHeight ); - const currentScroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; + const currentScroll = window.scrollY || document.documentElement.scrollTop || document.body.scrollTop || 0; const moveAmount = Math.max(pageHeight / max,150); window.scrollTo({ top: currentScroll + (moveAmount * isToDown) , behavior: "smooth" }); } diff --git a/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt b/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt index 5edf0dd2..416de6ae 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt @@ -21,9 +21,7 @@ package bums.lunatic.launcher //import rasel.lunar.launcher.home.LauncherHome.Companion.rssSet import android.annotation.SuppressLint -import android.app.NotificationManager import android.appwidget.AppWidgetManager -import android.content.ComponentName import android.content.Intent import android.content.SharedPreferences import android.content.res.Configuration @@ -31,10 +29,8 @@ import android.graphics.Color import android.net.Uri import android.os.Build import android.os.Bundle -import android.os.Environment.isExternalStorageManager import android.os.Handler import android.os.Looper -import android.provider.Settings import android.view.KeyEvent import android.view.KeyEvent.ACTION_UP import android.view.KeyEvent.KEYCODE_BUTTON_A @@ -46,19 +42,14 @@ import android.view.KeyEvent.KEYCODE_BUTTON_Y import android.view.KeyEvent.KEYCODE_DPAD_DOWN import android.view.KeyEvent.KEYCODE_DPAD_UP import android.view.MotionEvent -import android.view.View import android.view.WindowInsets import android.view.WindowManager import androidx.activity.OnBackPressedCallback import androidx.annotation.RequiresApi -import androidx.appcompat.app.AppCompatDelegate -import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM import androidx.core.net.toUri import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen import androidx.core.view.ViewCompat -import androidx.core.view.WindowCompat import androidx.core.view.WindowInsetsCompat -import androidx.core.view.isVisible import androidx.core.view.updatePadding import androidx.work.ExistingPeriodicWorkPolicy import androidx.work.OneTimeWorkRequest @@ -70,8 +61,6 @@ import bums.lunatic.launcher.tokiz.Novels import bums.lunatic.launcher.common.CommonActivity import bums.lunatic.launcher.databinding.LauncherActivityBinding import bums.lunatic.launcher.feeds.WidgetHost -import bums.lunatic.launcher.helpers.BluetoothManager -import bums.lunatic.launcher.helpers.Constants.Companion.KEY_APPLICATION_THEME import bums.lunatic.launcher.helpers.Constants.Companion.KEY_STATUS_BAR import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS import bums.lunatic.launcher.helpers.Constants.Companion.widgetHostId @@ -81,13 +70,11 @@ import bums.lunatic.launcher.home.LauncherHome 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 -import bums.lunatic.launcher.view.TableRadioGroup import bums.lunatic.launcher.workers.AppInfoGetter import bums.lunatic.launcher.workers.ArcaGetter import bums.lunatic.launcher.workers.CalendarGetter @@ -97,11 +84,10 @@ import bums.lunatic.launcher.workers.DCGetter import bums.lunatic.launcher.workers.DotaxGetter import bums.lunatic.launcher.workers.DotaxGetter.Companion.COMIC2_WORK_TAG import bums.lunatic.launcher.workers.FmKoreaGetter -import bums.lunatic.launcher.workers.FmKoreaGetter.Companion.COMIC_WORK_TAG +import bums.lunatic.launcher.workers.FmKoreaGetter.Companion.FM_WORK_TAG import bums.lunatic.launcher.workers.LocationGetter import bums.lunatic.launcher.workers.NewsFeedsGetter import bums.lunatic.launcher.workers.NewsFeedsGetter.Companion.FEDDS_WORK_TAG -import bums.lunatic.launcher.workers.OpenWeatherGetter import bums.lunatic.launcher.workers.RecentCallGetter import bums.lunatic.launcher.workers.RecentSmsGetter import bums.lunatic.launcher.workers.RecentSmsGetter.Companion.SMS_WORK_TAG @@ -202,7 +188,6 @@ internal class LauncherActivity : CommonActivity() { .addTag(RuliWebGetter.TAG) .build()) - mWorkManager?.cancelAllWorkByTag(FEDDS_WORK_TAG) mWorkManager?.enqueueUniquePeriodicWork( FEDDS_WORK_TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE, @@ -221,11 +206,11 @@ internal class LauncherActivity : CommonActivity() { PeriodicWorkRequestBuilder(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES) .addTag(REDDIT_WORK_TAG) .build()) - mWorkManager?.cancelAllWorkByTag(COMIC_WORK_TAG) + mWorkManager?.cancelAllWorkByTag(FM_WORK_TAG) mWorkManager?.enqueueUniquePeriodicWork( - COMIC_WORK_TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE, + FM_WORK_TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE, PeriodicWorkRequestBuilder(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES) - .addTag(COMIC_WORK_TAG) + .addTag(FM_WORK_TAG) .build()) mWorkManager?.cancelAllWorkByTag(COMIC2_WORK_TAG) mWorkManager?.enqueueUniquePeriodicWork( diff --git a/app/src/main/kotlin/bums/lunatic/launcher/feeds/rss/RssAdapter.kt b/app/src/main/kotlin/bums/lunatic/launcher/feeds/rss/RssAdapter.kt index 917a5367..bc3d78e1 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/feeds/rss/RssAdapter.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/feeds/rss/RssAdapter.kt @@ -31,7 +31,6 @@ import androidx.recyclerview.widget.RecyclerView import bums.lunatic.launcher.LauncherActivity.Companion.lActivity import bums.lunatic.launcher.databinding.ListItemWithBinding import bums.lunatic.launcher.home.adapters.RssItemDiffUtil -import bums.lunatic.launcher.model.JGuru import bums.lunatic.launcher.model.RssDataInterface import bums.lunatic.launcher.model.RssDataType import com.squareup.picasso.Picasso @@ -95,16 +94,6 @@ internal class RssAdapter(private val context: Context) : } holder.view.root.setOnLongClickListener { - if(item is JGuru) { - openOpera( - "https://cili.site/search?q=${ - URLEncoder.encode( - item.model, - Charset.defaultCharset().name() - ) - }" - ) - } openOpera(item.originPage()) true } diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/ExtHahMap.java b/app/src/main/kotlin/bums/lunatic/launcher/home/ExtHahMap.java new file mode 100644 index 00000000..9bc0e898 --- /dev/null +++ b/app/src/main/kotlin/bums/lunatic/launcher/home/ExtHahMap.java @@ -0,0 +1,31 @@ +//import androidx.annotation.Nullable; +// +//import java.util.HashMap; +// + +import androidx.annotation.Nullable; + +import java.util.HashMap; + +////package bums.lunatic.launcher.home; +//// +////import androidx.annotation.Nullable; +//// +////import java.util.HashMap; +//// +public class ExtHahMap extends HashMap { + @Nullable + @Override + public Object put(String key, Object value) { + if (value instanceof String) { + if (((String) value).length() > 0) { + + } else { + + } + }else { + return super.put(key, value); + } + } +} + diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/LauncherHome.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/LauncherHome.kt index 793470fc..cea16954 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/home/LauncherHome.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/home/LauncherHome.kt @@ -19,6 +19,7 @@ package bums.lunatic.launcher.home import android.annotation.SuppressLint +import android.content.Context import android.content.SharedPreferences import android.os.Build import android.os.Bundle @@ -201,7 +202,8 @@ internal class LauncherHome : Fragment() { } } when(rss.category()) { - RssDataType.GURU,RssDataType.MOST,RssDataType.REDDIT_NSFW -> { + //RssDataType.GURU,RssDataType.MOST, + RssDataType.REDDIT_NSFW -> { v.findViewById(R.id.circle_preview)?.let { if (it.visibility == View.GONE) { it.visibility = View.VISIBLE @@ -287,12 +289,15 @@ internal class LauncherHome : Fragment() { } } } + val nullCursor = PointerIcon.getSystemIcon(context!!, PointerIcon.TYPE_NULL) binding.root.setPointerIcon(nullCursor) return binding.root } + + fun vote(){ Blog.LOGE("Arrow Center Click") WorkersDb.getRealm().apply { @@ -369,7 +374,8 @@ internal class LauncherHome : Fragment() { } fun queryInfos( - filter: Collection? = arrayListOf(RssDataType.GURU, RssDataType.MOST,RssDataType.REDDIT_NSFW), noLimit: Boolean = false + //RssDataType.GURU, RssDataType.MOST, + filter: Collection? = arrayListOf(RssDataType.REDDIT_NSFW), noLimit: Boolean = false ) { beforeQuery() var rQ = WorkersDb.getRealm().query().query("read < $0", nomoreShowCount).distinct("originPage", "title") @@ -469,6 +475,8 @@ internal class LauncherHome : Fragment() { override fun onResume() { super.onResume() + val nullCursor = PointerIcon.getSystemIcon(context!!, PointerIcon.TYPE_NULL) + binding.root.setPointerIcon(nullCursor) if (shouldResume) { } @@ -482,3 +490,5 @@ internal class LauncherHome : Fragment() { + + diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/RssTagAdapter.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/RssTagAdapter.kt index 3fb4bb07..de25fcd7 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/RssTagAdapter.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/RssTagAdapter.kt @@ -1,125 +1,124 @@ -/* - * Lunar Launcher - * Copyright (C) 2022 Md Rasel Hossain - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package bums.lunatic.launcher.home.adapters - -import android.annotation.SuppressLint -import android.content.Context -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.RecyclerView -import bums.lunatic.launcher.LauncherActivity.Companion.lActivity -import bums.lunatic.launcher.R -import bums.lunatic.launcher.databinding.ListItemBinding -import bums.lunatic.launcher.model.jGuruTag -import com.google.gson.Gson - -internal class RssTagAdapter( - private val smsList: ArrayList, - private val context: Context) : RecyclerView.Adapter() { - - private val currentFragment = lActivity!!.supportFragmentManager.findFragmentById(R.id.mainFragmentsContainer) - - override fun onCreateViewHolder(viewGroup: ViewGroup, i: Int): RssTag { - val binding = ListItemBinding.inflate(LayoutInflater.from(viewGroup.context), viewGroup, false) - return RssTag(binding) - } - - override fun getItemCount(): Int { - return smsList.size - } - - @SuppressLint("SetTextI18n") - override fun onBindViewHolder(holder: RssTag, position: Int) { - val todo = smsList[position] - - holder.view.itemText.text = "\u25CF ${Gson().toJson(todo)}" - /* multiline texts are enabled for TodoManager */ -// holder.view.itemText.isSingleLine = false - /* launch edit or update dialog on item click */ -// holder.view.itemText.setOnClickListener { updateDialog(position) } - /* copy texts on long click */ - holder.view.itemText.setOnLongClickListener { - - true - } - - } - - inner class RssTag(var view: ListItemBinding) : RecyclerView.ViewHolder(view.root) - - fun updateData(newList: List) { - val diffUtilResult = DiffUtil.calculateDiff(RssTagDiffUtil(smsList, newList)) - diffUtilResult.dispatchUpdatesTo(this) -// smsList.clear() -// smsList.addAll(newList) - } - - /* update dialog */ - private fun updateDialog(position: Int) { -// val bottomSheetDialog = BottomSheetDialog(lActivity!!, R.style.BottomSheetDialog) -// val dialogBinding = TodoDialogBinding.inflate(LayoutInflater.from(context)) -// bottomSheetDialog.setContentView(dialogBinding.root) -// bottomSheetDialog.show() -// bottomSheetDialog.dismissWithAnimation = true +///* +// * Lunar Launcher +// * Copyright (C) 2022 Md Rasel Hossain +// * +// * This program is free software: you can redistribute it and/or modify +// * it under the terms of the GNU General Public License as published by +// * the Free Software Foundation, either version 3 of the License, or +// * (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have received a copy of the GNU General Public License +// * along with this program. If not, see . +// */ // -// val databaseHandler = DatabaseHandler(context) -// val todo = databaseHandler.todos[position] +//package bums.lunatic.launcher.home.adapters // -// dialogBinding.apply { -// deleteAllConfirmation.visibility = View.GONE -// todoInput.setText(todo.name) -// todoCancel.text = context.getString(R.string.delete) -// todoCancel.setTextColor(ContextCompat.getColor(context, android.R.color.holo_red_light)) -// todoOk.text = context.getString(R.string.update) +//import android.annotation.SuppressLint +//import android.content.Context +//import android.view.LayoutInflater +//import android.view.ViewGroup +//import androidx.recyclerview.widget.DiffUtil +//import androidx.recyclerview.widget.RecyclerView +//import bums.lunatic.launcher.LauncherActivity.Companion.lActivity +//import bums.lunatic.launcher.R +//import bums.lunatic.launcher.databinding.ListItemBinding +//import com.google.gson.Gson +// +//internal class RssTagAdapter( +// private val smsList: ArrayList, +// private val context: Context) : RecyclerView.Adapter() { +// +// private val currentFragment = lActivity!!.supportFragmentManager.findFragmentById(R.id.mainFragmentsContainer) +// +// override fun onCreateViewHolder(viewGroup: ViewGroup, i: Int): RssTag { +// val binding = ListItemBinding.inflate(LayoutInflater.from(viewGroup.context), viewGroup, false) +// return RssTag(binding) +// } +// +// override fun getItemCount(): Int { +// return smsList.size +// } +// +// @SuppressLint("SetTextI18n") +// override fun onBindViewHolder(holder: RssTag, position: Int) { +// val todo = smsList[position] +// +// holder.view.itemText.text = "\u25CF ${Gson().toJson(todo)}" +// /* multiline texts are enabled for TodoManager */ +//// holder.view.itemText.isSingleLine = false +// /* launch edit or update dialog on item click */ +//// holder.view.itemText.setOnClickListener { updateDialog(position) } +// /* copy texts on long click */ +// holder.view.itemText.setOnLongClickListener { +// +// true // } // -// /* delete the item */ -// dialogBinding.todoCancel.setOnClickListener { +// } // -// } +// inner class RssTag(var view: ListItemBinding) : RecyclerView.ViewHolder(view.root) // -// /* update the item */ -// dialogBinding.todoOk.setOnClickListener { -// val updatedTodoString = Objects.requireNonNull(dialogBinding.todoInput.text).toString().trim { it <= ' ' } -// if (updatedTodoString.isNotEmpty()) { -// todo.name = updatedTodoString -// databaseHandler.updateTodo(todo) -// bottomSheetDialog.dismiss() -// } else { -// dialogBinding.todoInput.error = context.getString(R.string.empty_text_field) -// } -// } - } - -} - -internal class RssTagDiffUtil( - private val oldList: List, private val newList: List -) : DiffUtil.Callback() { - - override fun getOldListSize(): Int = oldList.size - override fun getNewListSize(): Int = newList.size - - override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean = - oldList[oldItemPosition].link == newList[newItemPosition].link - - override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean = - oldList[oldItemPosition].link == newList[newItemPosition].link -} +// fun updateData(newList: List) { +// val diffUtilResult = DiffUtil.calculateDiff(RssTagDiffUtil(smsList, newList)) +// diffUtilResult.dispatchUpdatesTo(this) +//// smsList.clear() +//// smsList.addAll(newList) +// } +// +// /* update dialog */ +// private fun updateDialog(position: Int) { +//// val bottomSheetDialog = BottomSheetDialog(lActivity!!, R.style.BottomSheetDialog) +//// val dialogBinding = TodoDialogBinding.inflate(LayoutInflater.from(context)) +//// bottomSheetDialog.setContentView(dialogBinding.root) +//// bottomSheetDialog.show() +//// bottomSheetDialog.dismissWithAnimation = true +//// +//// val databaseHandler = DatabaseHandler(context) +//// val todo = databaseHandler.todos[position] +//// +//// dialogBinding.apply { +//// deleteAllConfirmation.visibility = View.GONE +//// todoInput.setText(todo.name) +//// todoCancel.text = context.getString(R.string.delete) +//// todoCancel.setTextColor(ContextCompat.getColor(context, android.R.color.holo_red_light)) +//// todoOk.text = context.getString(R.string.update) +//// } +//// +//// /* delete the item */ +//// dialogBinding.todoCancel.setOnClickListener { +//// +//// } +//// +//// /* update the item */ +//// dialogBinding.todoOk.setOnClickListener { +//// val updatedTodoString = Objects.requireNonNull(dialogBinding.todoInput.text).toString().trim { it <= ' ' } +//// if (updatedTodoString.isNotEmpty()) { +//// todo.name = updatedTodoString +//// databaseHandler.updateTodo(todo) +//// bottomSheetDialog.dismiss() +//// } else { +//// dialogBinding.todoInput.error = context.getString(R.string.empty_text_field) +//// } +//// } +// } +// +//} +// +//internal class RssTagDiffUtil( +// private val oldList: List, private val newList: List +//) : DiffUtil.Callback() { +// +// override fun getOldListSize(): Int = oldList.size +// override fun getNewListSize(): Int = newList.size +// +// override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean = +// oldList[oldItemPosition].link == newList[newItemPosition].link +// +// override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean = +// oldList[oldItemPosition].link == newList[newItemPosition].link +//} diff --git a/app/src/main/kotlin/bums/lunatic/launcher/model/Adults.kt b/app/src/main/kotlin/bums/lunatic/launcher/model/Adults.kt index 24896f1f..2bc30818 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/model/Adults.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/model/Adults.kt @@ -1,136 +1,136 @@ -package bums.lunatic.launcher.model - -import bums.lunatic.launcher.utils.JamoUtils - - -class MostItem : JGuru , RssDataInterface { - - constructor() : super() - - override fun title(): String { - return title - } - - override fun thumbnailUrl(): String { - return image - } - - override fun originPage(): String { - return pageLink - } - - override fun description(): String { - return tags.plus(", ").plus(model).plus(", ").plus(category()) - } - - override fun pubDate(): Long { - return date - } - - override fun category(): RssDataType { - return RssDataType.MOST - } - - override fun getCho(): String? { - return JamoUtils.split(title!!).joinToString("") - } -} -open class JGuru : RssDataInterface { - var model : String = "" - var title : String = "" - var pageLink : String = "" - var image : String = "" - var tags : String = "" - var date : Long = 0L - - constructor( - model: String, - title: String, - pageLink: String, - image: String, - tags: String, - date: Long - ) { - this.model = model - this.title = title - this.pageLink = pageLink - this.image = image - this.tags = tags - this.date = date - } - - constructor() - - override fun title(): String { - return title - } - - override fun thumbnailUrl(): String { - return image - } - - override fun originPage(): String { - return pageLink - } - - override fun description(): String { - return tags.plus(", ").plus(model).plus(", ").plus(category()) - } - - override fun pubDate(): Long { - return date - } - - override fun category(): RssDataType { - return RssDataType.GURU - } - - fun isValid() = (((pageLink.length ?:0) > 0) && ((title.length ?:0) > 0)&& ((image.length ?:0) > 0)) - - override fun getCho(): String? { - return JamoUtils.split(title!!).joinToString("") - } -} - -class jGuruTag : RssDataInterface { - var link : String = "" - var tagTitle = "" - var count = 0 - - override fun title(): String { - return tagTitle - } - - override fun thumbnailUrl(): String { - return "" - } - - override fun originPage(): String { - return link - } - - override fun description(): String { - return " " - } - - override fun pubDate(): Long { - return count.toLong() - } - - override fun category(): RssDataType { - return RssDataType.TAGS - } - - constructor(link: String, tagTitle: String) { - this.link = link - this.tagTitle = tagTitle - if (tagTitle.contains("(") && tagTitle.contains(")")) { - try { - count = tagTitle.split("(")[1].split(")")[0].toInt() - }catch (e : Exception) {} - } - } - override fun getCho(): String? { - return JamoUtils.split(tagTitle!!).joinToString("") - } -} +//package bums.lunatic.launcher.model +// +//import bums.lunatic.launcher.utils.JamoUtils +// +// +//class MostItem : JGuru , RssDataInterface { +// +// constructor() : super() +// +// override fun title(): String { +// return title +// } +// +// override fun thumbnailUrl(): String { +// return image +// } +// +// override fun originPage(): String { +// return pageLink +// } +// +// override fun description(): String { +// return tags.plus(", ").plus(model).plus(", ").plus(category()) +// } +// +// override fun pubDate(): Long { +// return date +// } +// +// override fun category(): RssDataType { +// return RssDataType.MOST +// } +// +// override fun getCho(): String? { +// return JamoUtils.split(title!!).joinToString("") +// } +//} +//open class JGuru : RssDataInterface { +// var model : String = "" +// var title : String = "" +// var pageLink : String = "" +// var image : String = "" +// var tags : String = "" +// var date : Long = 0L +// +// constructor( +// model: String, +// title: String, +// pageLink: String, +// image: String, +// tags: String, +// date: Long +// ) { +// this.model = model +// this.title = title +// this.pageLink = pageLink +// this.image = image +// this.tags = tags +// this.date = date +// } +// +// constructor() +// +// override fun title(): String { +// return title +// } +// +// override fun thumbnailUrl(): String { +// return image +// } +// +// override fun originPage(): String { +// return pageLink +// } +// +// override fun description(): String { +// return tags.plus(", ").plus(model).plus(", ").plus(category()) +// } +// +// override fun pubDate(): Long { +// return date +// } +// +// override fun category(): RssDataType { +// return RssDataType.GURU +// } +// +// fun isValid() = (((pageLink.length ?:0) > 0) && ((title.length ?:0) > 0)&& ((image.length ?:0) > 0)) +// +// override fun getCho(): String? { +// return JamoUtils.split(title!!).joinToString("") +// } +//} +// +//class jGuruTag : RssDataInterface { +// var link : String = "" +// var tagTitle = "" +// var count = 0 +// +// override fun title(): String { +// return tagTitle +// } +// +// override fun thumbnailUrl(): String { +// return "" +// } +// +// override fun originPage(): String { +// return link +// } +// +// override fun description(): String { +// return " " +// } +// +// override fun pubDate(): Long { +// return count.toLong() +// } +// +// override fun category(): RssDataType { +// return RssDataType.TAGS +// } +// +// constructor(link: String, tagTitle: String) { +// this.link = link +// this.tagTitle = tagTitle +// if (tagTitle.contains("(") && tagTitle.contains(")")) { +// try { +// count = tagTitle.split("(")[1].split(")")[0].toInt() +// }catch (e : Exception) {} +// } +// } +// override fun getCho(): String? { +// return JamoUtils.split(tagTitle!!).joinToString("") +// } +//} diff --git a/app/src/main/kotlin/bums/lunatic/launcher/model/RssDataInterface.kt b/app/src/main/kotlin/bums/lunatic/launcher/model/RssDataInterface.kt index a432706c..6c8a391e 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/model/RssDataInterface.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/model/RssDataInterface.kt @@ -8,8 +8,8 @@ enum class RssDataType { NO_DATA, YOUTUBE, NEWSFEED, - GURU, - MOST, +// GURU, +// MOST, TAGS, REDDIT, REDDIT_NSFW, @@ -35,24 +35,28 @@ enum class RssDataType { fun defaultImgSize() = when (this) { YOUTUBE -> 200 - REDDIT_NSFW,GURU,MOST -> 360 + REDDIT_NSFW -> 360 + //,GURU,MOST else -> { 120 } } fun getDefaultVisibiliy() = when (this) { - REDDIT_NSFW,GURU,MOST,NEWSFEED -> View.GONE + //,GURU,MOST + REDDIT_NSFW,NEWSFEED -> View.GONE else -> { View.VISIBLE } } fun isOn(block : ()->Unit) { - if(PrefHelper.getBoolean(name,false)) { - block.invoke() - } + block.invoke() +// if(PrefHelper.getBoolean(name,false)) { +// block.invoke() +// } } companion object { fun getExcAdt() = arrayListOf(NEWSFEED, REDDIT, DOTAX, FMKORAE, DCINSIDE, RULIWEB, CLIEN, THEQOO, ARCA).map { it.name } - fun getAdts() = arrayListOf( REDDIT_NSFW, MOST,GURU).map { it.name } + fun getAdts() = arrayListOf( REDDIT_NSFW).map { it.name } + //, MOST,GURU } } diff --git a/app/src/main/kotlin/bums/lunatic/launcher/tokiz/BaseToki.kt b/app/src/main/kotlin/bums/lunatic/launcher/tokiz/BaseToki.kt index 6bba608d..73c855a0 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/tokiz/BaseToki.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/tokiz/BaseToki.kt @@ -1,5 +1,6 @@ package bums.lunatic.launcher.tokiz +import android.content.Context import android.content.DialogInterface import android.content.Intent import android.content.pm.ActivityInfo @@ -329,6 +330,7 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface { return } binding.menuWeb.postDelayed({ + Blog.LOGE("onPageStop $success from WebExtension ${mPort!!.name}") val message: JSONObject = JSONObject() try { @@ -340,6 +342,8 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface { } mPort!!.postMessage(message) + + when(this@BaseToki) { is Comics , is Webtoons -> { lastInfo @@ -646,6 +650,8 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface { override fun onResume() { super.onResume() + val nullCursor = PointerIcon.getSystemIcon(context!!, PointerIcon.TYPE_NULL) + binding.root.setPointerIcon(nullCursor) loadLastInfo() } @@ -702,6 +708,8 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface { } } + + fun onBookInfos(jsonString: String) { Blog.LOGE("onBookInfos", "jsonString >> ${jsonString}") val realm = openRealm() diff --git a/app/src/main/kotlin/bums/lunatic/launcher/utils/JsoupUtils.kt b/app/src/main/kotlin/bums/lunatic/launcher/utils/JsoupUtils.kt index 55467170..8e867163 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/utils/JsoupUtils.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/utils/JsoupUtils.kt @@ -1,7 +1,6 @@ package bums.lunatic.launcher.utils import bums.lunatic.launcher.home.LauncherHome.Companion.lastedFinishedPageUrl -import bums.lunatic.launcher.model.MostItem import bums.lunatic.launcher.model.RssData import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.dateFormat @@ -67,28 +66,28 @@ object QVZTb2dpcmw : SoInterface { return String(Base64.getMimeDecoder().decode(this.javaClass.simpleName.plus("==").toByteArray())) } override fun parse(doc : Document, consoleLog : (String)-> Unit) { - doc.getElementsByTag("article").forEach { article -> - consoleLog("ogirl article >>> ${article.text()}") - val title = article.getElementsByTag("a").get(0).attr("title") - val href = article.getElementsByTag("a").get(0).attr("href") - val img = article.getElementsByTag("img").get(0).attr("data-src") - WorkersDb.getRealm().writeBlocking { - if (query("originPage == $0", href).find().size == 0) { - RssData().apply { - this.originPage = href - this.title = title - this.description = "Sogirl" - this.thumbnail = img - this.pubDate = Date().time - this.category = RssDataType.GURU.name - this.chosung = - JamoUtils.split(title).joinToString("") - copyToRealm(this) - } - consoleLog("title $title | href $href | img $img" ) - } - } - } +// doc.getElementsByTag("article").forEach { article -> +// consoleLog("ogirl article >>> ${article.text()}") +// val title = article.getElementsByTag("a").get(0).attr("title") +// val href = article.getElementsByTag("a").get(0).attr("href") +// val img = article.getElementsByTag("img").get(0).attr("data-src") +// WorkersDb.getRealm().writeBlocking { +// if (query("originPage == $0", href).find().size == 0) { +// RssData().apply { +// this.originPage = href +// this.title = title +// this.description = "Sogirl" +// this.thumbnail = img +// this.pubDate = Date().time +// this.category = RssDataType.GURU.name +// this.chosung = +// JamoUtils.split(title).joinToString("") +// copyToRealm(this) +// } +// consoleLog("title $title | href $href | img $img" ) +// } +// } +// } } } object SkFWTW9zdA : SoInterface { @@ -97,31 +96,31 @@ object SkFWTW9zdA : SoInterface { return String(Base64.getMimeDecoder().decode(this.javaClass.simpleName.plus("==").toByteArray())) } override fun parse(doc: Document, consoleLog: (String) -> Unit) { - consoleLog("$lastedFinishedPageUrl >>> ${doc.title()}") - doc.getElementsByClass("card").forEach { card -> - var thumb = if(card.getElementsByTag("img").size > 0) card.getElementsByTag("img").get(0).attr("src") else "" - if (thumb.contains("No+Poster")) thumb = if(card.getElementsByTag("img").size > 0) card.getElementsByTag("img").get(0).attr("data-src") else thumb - var model = if(card.getElementsByTag("img").size > 0) card.getElementsByTag("img").get(0).attr("alt") else "" - if(card.getElementsByClass("card-block").size > 0) if(card.getElementsByClass("card-block").size > 0) { - val link = card.getElementsByClass("card-block").get(0).getElementsByTag("a").get(0).attr("href") - val title = card.getElementsByClass("card-block").get(0).getElementsByTag("a").get(0).attr("title") - val date = card.getElementsByTag("span").get(0).text() - MostItem().let { ms -> - ms.model = model - ms.image = thumb - ms.pageLink = link - ms.title = title - try { - ms.date = dmy.parse(date).time - consoleLog("dateFormat.format(Date(ms.date)) ${dateFormat.format(Date(ms.date))}") - }catch (e : Exception) {e.printStackTrace()} - if (ms.isValid()) { - WorkersDb.insertData(ms.getRssData()) - } - } - consoleLog(" model >>>>> ${model}\n | thumb >>>>> ${thumb}\n | title >>>>> ${title}\n | date >>>>> ${date} | ") - } - } - consoleLog("excuted j req() ${WorkersDb.getRealm().query("category == $0", RssDataType.GURU.name).find().size}") +// consoleLog("$lastedFinishedPageUrl >>> ${doc.title()}") +// doc.getElementsByClass("card").forEach { card -> +// var thumb = if(card.getElementsByTag("img").size > 0) card.getElementsByTag("img").get(0).attr("src") else "" +// if (thumb.contains("No+Poster")) thumb = if(card.getElementsByTag("img").size > 0) card.getElementsByTag("img").get(0).attr("data-src") else thumb +// var model = if(card.getElementsByTag("img").size > 0) card.getElementsByTag("img").get(0).attr("alt") else "" +// if(card.getElementsByClass("card-block").size > 0) if(card.getElementsByClass("card-block").size > 0) { +// val link = card.getElementsByClass("card-block").get(0).getElementsByTag("a").get(0).attr("href") +// val title = card.getElementsByClass("card-block").get(0).getElementsByTag("a").get(0).attr("title") +// val date = card.getElementsByTag("span").get(0).text() +// MostItem().let { ms -> +// ms.model = model +// ms.image = thumb +// ms.pageLink = link +// ms.title = title +// try { +// ms.date = dmy.parse(date).time +// consoleLog("dateFormat.format(Date(ms.date)) ${dateFormat.format(Date(ms.date))}") +// }catch (e : Exception) {e.printStackTrace()} +// if (ms.isValid()) { +// WorkersDb.insertData(ms.getRssData()) +// } +// } +// consoleLog(" model >>>>> ${model}\n | thumb >>>>> ${thumb}\n | title >>>>> ${title}\n | date >>>>> ${date} | ") +// } +// } +// consoleLog("excuted j req() ${WorkersDb.getRealm().query("category == $0", RssDataType.GURU.name).find().size}") } } \ No newline at end of file diff --git a/app/src/main/kotlin/bums/lunatic/launcher/workers/ArcaGetter.kt b/app/src/main/kotlin/bums/lunatic/launcher/workers/ArcaGetter.kt index 6e379003..9604f54e 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/workers/ArcaGetter.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/workers/ArcaGetter.kt @@ -7,6 +7,7 @@ import bums.lunatic.launcher.model.RssDataInterface import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.getRssData import bums.lunatic.launcher.model.getT +import bums.lunatic.launcher.utils.Blog import bums.lunatic.launcher.utils.beforeOneDay //import bums.lunatic.launcher.workers.WorkersDb.blockKeyword import org.jsoup.Jsoup @@ -23,6 +24,7 @@ class ArcaGetter : BaseGetter { override fun realWork(): Result { RssDataType.ARCA.isOn { try { + Blog.LOGE("realWork() ${this::class.simpleName}") temp.clear() val urls = arrayListOf( "https://arca.live/b/singbung?mode=best", @@ -34,22 +36,33 @@ class ArcaGetter : BaseGetter { // "https://arca.live/b/breaking" ) urls.forEach { - Jsoup.connect(it) - .userAgent(USAGT) - .get().let { arca -> + try { + Jsoup.connect(it) + .userAgent(USAGT) + .header("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8") + .header("accept-language", "ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7") + .header("cache-control", "no-cache") + .header("pragma", "no-cache") + .ignoreContentType(true) + .timeout(5000) + .get().let { arca -> // BLog.LOGE("url >> ${it} >> ${arca}") - arca.getElementsByClass("vrow hybrid").forEach { araca_li -> - if (araca_li.html().contains("title ") == true) { - parseArcaLi(araca_li).apply { - this.forEach { - if (it.pubDate() > commicsDateTime) { - temp.add(it.getRssData()) + arca.getElementsByClass("vrow hybrid").forEach { araca_li -> + if (araca_li.html().contains("title ") == true) { + parseArcaLi(araca_li).apply { + this.forEach { + if (it.pubDate() > commicsDateTime) { + temp.add(it.getRssData()) + } } } } } } - } + } catch (e : Exception) { + e.printStackTrace() + } + } // Jsoup.connect("https://projrctjav.com").userAgent(USAGT).get().let { projectj -> // BLog.LOGE("projectj >>>>> ${projectj}") diff --git a/app/src/main/kotlin/bums/lunatic/launcher/workers/BaseGetter.kt b/app/src/main/kotlin/bums/lunatic/launcher/workers/BaseGetter.kt index 86652641..3447c1f3 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/workers/BaseGetter.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/workers/BaseGetter.kt @@ -22,7 +22,7 @@ open abstract class BaseGetter : Worker { } } - val USAGT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.15" + val USAGT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36" val limitDateTime = beforeOneDay() val commicsDateTime = beforeDay(1) diff --git a/app/src/main/kotlin/bums/lunatic/launcher/workers/ClienGetter.kt b/app/src/main/kotlin/bums/lunatic/launcher/workers/ClienGetter.kt index a80a0be4..fee02a0d 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/workers/ClienGetter.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/workers/ClienGetter.kt @@ -8,6 +8,7 @@ import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.getHref import bums.lunatic.launcher.model.getRssData import bums.lunatic.launcher.model.getT +import bums.lunatic.launcher.utils.Blog import org.jsoup.Jsoup class ClienGetter : BaseGetter { @@ -71,6 +72,7 @@ class ClienGetter : BaseGetter { @SuppressLint("RestrictedApi") override fun realWork(): Result { RssDataType.CLIEN.isOn { + Blog.LOGE("realWork() ${this::class.simpleName}") try { temp.clear() val testUrl2 = arrayListOf("https://www.clien.net/service/group/community","https://www.clien.net/service/board/park","https://www.clien.net/service/board/news","https://www.clien.net/service/board/useful","https://www.clien.net/service/board/pds") diff --git a/app/src/main/kotlin/bums/lunatic/launcher/workers/DCGetter.kt b/app/src/main/kotlin/bums/lunatic/launcher/workers/DCGetter.kt index 1a1927cb..15c3c3b7 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/workers/DCGetter.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/workers/DCGetter.kt @@ -8,6 +8,7 @@ import bums.lunatic.launcher.model.DcInside import bums.lunatic.launcher.model.RssDataInterface import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.getRssData +import bums.lunatic.launcher.utils.Blog import org.jsoup.Jsoup import java.text.SimpleDateFormat @@ -73,6 +74,7 @@ class DCGetter : BaseGetter { override fun realWork(): Result { // Blog.LOGE("${TAG} RssDataType.DCINSIDE.isOn >>>> ${PrefHelper.getBoolean(RssDataType.DCINSIDE.name,false)}") RssDataType.DCINSIDE.isOn { + Blog.LOGE("realWork() ${this::class.simpleName}") temp.clear() // https://m.dcinside.com/board/singlebungle1472 var urls = arrayListOf( diff --git a/app/src/main/kotlin/bums/lunatic/launcher/workers/DotaxGetter.kt b/app/src/main/kotlin/bums/lunatic/launcher/workers/DotaxGetter.kt index f550da5f..d8303f5a 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/workers/DotaxGetter.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/workers/DotaxGetter.kt @@ -6,6 +6,7 @@ import androidx.work.WorkerParameters import bums.lunatic.launcher.model.Dotax import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.getRssData +import bums.lunatic.launcher.utils.Blog import org.jsoup.Jsoup class DotaxGetter : BaseGetter { @@ -20,6 +21,7 @@ class DotaxGetter : BaseGetter { override fun realWork(): Result { RssDataType.DOTAX.isOn { try { + Blog.LOGE("realWork() ${this::class.simpleName}") temp.clear() val dotaxUrls = arrayListOf("https://m.cafe.daum.net/dotax", "https://m.cafe.daum.net/dotax/_rec?page=2", @@ -28,6 +30,7 @@ class DotaxGetter : BaseGetter { dotaxUrls?.forEach { Jsoup.connect(it).userAgent(USAGT).get()?.let { dotax -> dotax.getElementsByTag("li").forEach { dotax_li -> + Blog.LOGE("dotax_li >>> ${dotax_li.text()}") if (dotax_li.getElementsByTag("a").size > 0 && dotax_li.getElementsByClass("board_name") .html().contains("웃긴") ) { diff --git a/app/src/main/kotlin/bums/lunatic/launcher/workers/FmKoreaGetter.kt b/app/src/main/kotlin/bums/lunatic/launcher/workers/FmKoreaGetter.kt index 1ea442ff..cf50fa41 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/workers/FmKoreaGetter.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/workers/FmKoreaGetter.kt @@ -6,12 +6,13 @@ import androidx.work.WorkerParameters import bums.lunatic.launcher.model.FmKorea import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.getRssData +import bums.lunatic.launcher.utils.Blog import org.jsoup.Jsoup import java.util.Date class FmKoreaGetter : BaseGetter { companion object { - val COMIC_WORK_TAG = "ComicGetter" + val FM_WORK_TAG = "FmKoreaGetter" } constructor(context: Context, workerParams: WorkerParameters) : super(context, workerParams) { @@ -36,6 +37,7 @@ class FmKoreaGetter : BaseGetter { RssDataType.FMKORAE.isOn { val now = Date() try { + Blog.LOGE("realWork() ${this::class.simpleName}") val fmkoreaUrls = arrayListOf("https://m.fmkorea.com","https://m.fmkorea.com/best","https://m.fmkorea.com/best2") fmkoreaUrls.forEach { try { diff --git a/app/src/main/kotlin/bums/lunatic/launcher/workers/RuliWebGetter.kt b/app/src/main/kotlin/bums/lunatic/launcher/workers/RuliWebGetter.kt index 435d62a0..c12612a8 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/workers/RuliWebGetter.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/workers/RuliWebGetter.kt @@ -7,6 +7,7 @@ import androidx.work.WorkerParameters import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.RuliWeb import bums.lunatic.launcher.model.getRssData +import bums.lunatic.launcher.utils.Blog import org.jsoup.Jsoup class RuliWebGetter : BaseGetter { @@ -17,6 +18,7 @@ class RuliWebGetter : BaseGetter { } fun parseRuli(ruli_tr : org.jsoup.nodes.Element) { + Blog.LOGE("ruli_tr >>> ${ruli_tr.text()}") var aTags = ruli_tr.getElementsByTag("a") var tagIdx = 0 var pageLink = "" @@ -62,13 +64,19 @@ class RuliWebGetter : BaseGetter { override fun realWork(): Result { RssDataType.RULIWEB.isOn { try { + Blog.LOGE("realWork() ${this::class.simpleName}") val testUrl2 = arrayListOf("https://bbs.ruliweb.com/best/humor_only","https://bbs.ruliweb.com/best/humor_only/now?m=humor_only&t=default&page=2") testUrl2.forEach { url -> Jsoup.connect(url).timeout(5000).ignoreHttpErrors(true) .userAgent(USAGT) + .header("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8") + .header("accept-language", "ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7") + .header("cache-control", "no-cache") + .header("pragma", "no-cache") + .ignoreContentType(true) .get().let { ruli -> // Blog.LOGE(TAG.plus("test ${testUrl2} >> ${ruli.title()}")) - ruli.getElementsByTag("tr").forEach { ruli_tr -> + ruli.getElementsByClass("table_body blocktarget").forEach { ruli_tr -> parseRuli(ruli_tr) } }