Compare commits

...

2 Commits

Author SHA1 Message Date
f56c43d82b Merge branch 'main' of https://dev.lunaticbum.kr/lun_admin/android_multiviewwer
# Conflicts:
#	app/src/main/kotlin/bums/lunatic/launcher/home/RssHome.kt
#	app/src/main/kotlin/bums/lunatic/launcher/utils/JsoupUtils.kt
...
2025-07-23 16:40:50 +09:00
2719b7d291 . 2025-07-23 10:43:45 +09:00
28 changed files with 963 additions and 3430 deletions

View File

@ -5,6 +5,7 @@ plugins {
id ("com.android.application")
id ("kotlin-android")
id ("io.realm.kotlin")
id ("kotlin-kapt")
}
android {
@ -110,6 +111,7 @@ dependencies {
implementation("com.github.delight-im:Android-AdvancedWebView:v3.2.1")
implementation(project(":library"))
implementation(project(":utils"))
implementation( "com.github.bumptech.glide:glide:4.11.0")
// implementation("org.mozilla.geckoview:geckoview:139.0.20250523173407")
// https://mvnrepository.com/artifact/org.mozilla.geckoview/geckoview
implementation("org.mozilla.geckoview:geckoview:139.0.20250523173407")

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
const list = ["?page=2","?page=3","?page=4","?page=5","?page=6"];
const port = browser.runtime.connectNative("browser");
port.onMessage.addListener(response => {
var type= response["type"];
@ -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" });
}
@ -285,5 +285,126 @@ if (port) {
)
}
if (document.querySelectorAll('[class^="col-md-4 mb-4 video-item"]').length > 1) {
var datas = []
document.querySelectorAll('[class^="col-md-4 mb-4 video-item"]').forEach(function (e) {
var date = 0
try {
const dateString = e.querySelector('[class^="mb-2"]').querySelector("a").textContent.trim();
const [day, month, year] = dateString.split("/").map(Number);
date = new Date(year, month - 1, day).getTime();
}catch (e) {
}
var actor = ""
try {
actor = e.querySelector('[class^="mb-1"]').getAttribute("alt").trim()
}catch (e) {
}
var desc = ""
try {
e.querySelectorAll('[class^="badge badge-"]').forEach(function (e) {
try {
if (Number(e.textContent) > 0) {
}else {
if (desc.length > 0) {
desc += ","
}
desc += e.textContent.trim()
}
}catch (e) {}
}
)
}catch (e) {
}
var thumb = ""
try {
thumb = e.querySelector("td").querySelector("a").getAttribute('data-link')
}catch (e) {
}
var magnet = ""
try {
e.querySelectorAll("td").forEach(function (e) {
e.querySelectorAll("a").forEach(function (e) {
if(e.getAttribute("href").startsWith("magnet")) {
magnet = e.getAttribute("href").replaceAll("&", "&");
}
})
})
}catch (e) {
}
var title = "";
try {
title = e.querySelector(".name").querySelector("a").querySelector("span").textContent.trim();
}catch (e) {
}
var originPage = ""
try {
originPage = location.protocol + "//" + location.hostname + e.querySelector(".name").querySelector("a").getAttribute("href");
}catch (e) {
}
var screenshots = ""
try {
e.querySelectorAll("a").forEach(function (e) {
if(e.getAttribute("href").search("screenshots") > -1) {
screenshots = e.getAttribute("href");
}
})
}catch (e) {
}
datas.push({
"title" : title,
"description" : desc,
"originPage" : originPage,
"magnet" : magnet,
"thumbnail" : thumb,
"pubDate" : date,
"screenshots" : screenshots,
"chosung" : "",
"category" : "PRIVATE"
});
})
sendMessage(
{
type: "PRIVATES",
privates: datas
}
);
gotoNext()
}
},1500)
}
function gotoNext() {
if (location.href.search("page") < 0) {
targetUrl = location.protocol + "//" + location.hostname + "/" + list[0]
}else {
var targetUrl = ""
for (i = 0; i < list.length - 1; i++) {
try {
if (location.href.search(list[i]) > -1) {
targetUrl = location.protocol + "//" + location.hostname + list[i + 1]
}
}catch (e) {
console.error(e)
}
}
}
if (targetUrl.length > 5) {
setTimeout(function () {location.href = targetUrl},3000)
}
}

View File

@ -50,6 +50,7 @@ import androidx.core.net.toUri
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.isVisible
import androidx.core.view.updatePadding
import androidx.work.ExistingPeriodicWorkPolicy
import androidx.work.OneTimeWorkRequest
@ -84,7 +85,7 @@ 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
@ -188,7 +189,6 @@ internal class LauncherActivity : CommonActivity() {
.addTag(RuliWebGetter.TAG)
.build())
mWorkManager?.cancelAllWorkByTag(FEDDS_WORK_TAG)
mWorkManager?.enqueueUniquePeriodicWork(
FEDDS_WORK_TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
@ -207,11 +207,11 @@ internal class LauncherActivity : CommonActivity() {
PeriodicWorkRequestBuilder<RedditGetter>(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<FmKoreaGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
.addTag(COMIC_WORK_TAG)
.addTag(FM_WORK_TAG)
.build())
mWorkManager?.cancelAllWorkByTag(COMIC2_WORK_TAG)
mWorkManager?.enqueueUniquePeriodicWork(
@ -730,7 +730,11 @@ internal class LauncherActivity : CommonActivity() {
val currentFragment = supportFragmentManager.findFragmentById(R.id.fragment_container)
when(currentFragment) {
is RssHome ->{
currentFragment.doNextPage()
if (currentFragment.binding.layoutRssSummary.root.isVisible) {
currentFragment.openGecko("")
} else {
currentFragment.doNextPage()
}
}
}
}

View File

@ -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<T : RssDataInterface>(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
}

View File

@ -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<String,Object> {
// @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);
// }
// }
//}
//

View File

@ -28,12 +28,18 @@ import android.widget.ProgressBar
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import bums.lunatic.launcher.LauncherActivity.Companion.getRuntime
import bums.lunatic.launcher.tokiz.data.HistoryManager
import bums.lunatic.launcher.tokiz.data.model.History
import bums.lunatic.launcher.tokiz.data.model.PortMessage
import bums.lunatic.launcher.tokiz.view.BWebview
import bums.lunatic.launcher.tokiz.view.JxEvent
import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.utils.afterDay
import bums.lunatic.launcher.workers.WorkersDb
import com.google.gson.Gson
import org.json.JSONException
import org.json.JSONObject
import org.jsoup.Jsoup
import org.mozilla.gecko.util.ThreadUtils
import org.mozilla.geckoview.ExperimentDelegate
import org.mozilla.geckoview.GeckoResult
@ -277,7 +283,7 @@ class GeckoWeb : BWebview {
dm.enqueue(request)
Toast.makeText(context, "다운로드 시작: $fileName", Toast.LENGTH_SHORT).show()
}
fun getFilterF() = String(java.util.Base64.getMimeDecoder().decode("aHR0cHM6Ly9pamF2dG9ycmVudC5jb20=".toByteArray()))
val contentDelegate = object : GeckoSession.ContentDelegate {
override fun onTitleChange(
session: GeckoSession,
@ -339,17 +345,20 @@ class GeckoWeb : BWebview {
}
override fun onPageStart(session: GeckoSession, url: String) {
super.onPageStart(session, url)
if (url?.contains("reddit.app.link") == true) {
session.stop()
Uri.parse(url)?.let { uri ->
context.startActivity(Intent().apply {
action = Intent.ACTION_VIEW
flags = Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS.or(FLAG_ACTIVITY_CLEAR_TOP).or(
FLAG_ACTIVITY_NEW_TASK)
data = uri
})
}
if (url.contains(getFilterF()) && url.contains("jpg") == false) {
this@GeckoWeb.visibility = View.INVISIBLE
}
// if (url?.contains("reddit.app.link") == true) {
// session.stop()
// Uri.parse(url)?.let { uri ->
// context.startActivity(Intent().apply {
// action = Intent.ACTION_VIEW
// flags = Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS.or(FLAG_ACTIVITY_CLEAR_TOP).or(
// FLAG_ACTIVITY_NEW_TASK)
// data = uri
// })
// }
// }
}
override fun onPageStop(session: GeckoSession, success: Boolean) {
@ -362,6 +371,7 @@ class GeckoWeb : BWebview {
}
}
}
}
@ -411,6 +421,9 @@ class GeckoWeb : BWebview {
Blog.LOGE("GeckoView", "현재 session: $session")
url?.let { url ->
if (url?.contains(getFilterF()) == true && url.contains("jpg") == false) {
this@GeckoWeb.visibility = View.INVISIBLE
}
if (url.split("//").size > 1) {
url.replace("//", "/").replace("https:/", "https://").let {
Blog.LOGE("url >> ${url} , it >>> ${it}")
@ -439,7 +452,45 @@ class GeckoWeb : BWebview {
message: Any, port: WebExtension.Port
) {
Blog.LOGE("PortDelegate", "Received message from extension: $message")
if (message is String && message.contains("type")) {
try {
var lPortMessage =
Gson().fromJson<PortMessage>(message, PortMessage::class.java)
when(lPortMessage.type) {
"getListResult" -> {
}
"BookContents"->{
}
"NotRegistered" -> {
}
"WebtoonContents"-> {
}
"MSG" -> {
}
"SHOWVIEWER" -> {
}
"PRIVATES"->{
lPortMessage.privates?.forEach {
Blog.LOGE("Item screenshots >>> ${it.screenshots}")
it.pubDate = afterDay(it.pubDate)
WorkersDb.insertData(it)
}
}
"PagerContents" -> {
if (lPortMessage.contents?.isNotEmpty() == true) {
}
}
else -> {
}
}
} catch (e: Exception) {
e.printStackTrace()
}
}
}
@ -447,7 +498,7 @@ class GeckoWeb : BWebview {
// This port is not usable anymore.
mPort = null
mPort = null
}
@ -520,10 +571,10 @@ class GeckoWeb : BWebview {
object : MessageDelegate {
override fun onConnect(port: WebExtension.Port) {
Blog.LOGE("onConnect port >>> ${port.name}")
// if (port.name === "browser") {
// mPort = port
// mPort!!.setDelegate(portDelegate)
// }
if (port != null) {
mPort = port
mPort!!.setDelegate(portDelegate)
}
}
override fun onMessage(

View File

@ -19,7 +19,10 @@
package bums.lunatic.launcher.home
import android.annotation.SuppressLint
import android.content.Intent
import android.content.SharedPreferences
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.os.Looper
@ -27,9 +30,11 @@ import android.view.LayoutInflater
import android.view.PointerIcon
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.Toast
import androidx.annotation.NonNull
import androidx.core.view.isVisible
import androidx.databinding.BindingAdapter
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.DividerItemDecoration
@ -37,6 +42,7 @@ import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.R
import bums.lunatic.launcher.common.letTrue
import bums.lunatic.launcher.databinding.LauncherHomeBinding
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import bums.lunatic.launcher.home.adapters.RssItemAdapter
@ -53,6 +59,7 @@ import bums.lunatic.launcher.utils.SimpleFingerGestures
import bums.lunatic.launcher.utils.beforeDay
import bums.lunatic.launcher.utils.beforeOneDay
import bums.lunatic.launcher.workers.WorkersDb
import com.bumptech.glide.Glide
import com.google.android.material.imageview.ShapeableImageView
import io.realm.kotlin.UpdatePolicy
import io.realm.kotlin.ext.query
@ -86,7 +93,7 @@ internal class RssHome : Fragment() {
var result: RealmResults<WeatherForcast>? = null
val nomoreShowCount = 5
fun rssStateVote() = (lasted?.filter { it.vote == true }?.size ?: -1) == (lasted?.size ?: 0)
var lasted: List<RssData>? = null
var lasted: ArrayList<RssData> = arrayListOf()
var infosJob: Job? = null
var rssId = ""
lateinit var mRssAdapter: RssItemAdapter
@ -102,7 +109,9 @@ internal class RssHome : Fragment() {
gestureDistance: Double
): Boolean {
Blog.LOGE("")
if (imageView){
openGecko("")
}
return true
}
@ -112,6 +121,9 @@ internal class RssHome : Fragment() {
gestureDuration: Long,
gestureDistance: Double
): Boolean {
if (imageView){
openGecko("")
}
Blog.LOGE("")
return true
}
@ -199,18 +211,27 @@ internal class RssHome : Fragment() {
}
}
when(rss.category()) {
RssDataType.GURU,RssDataType.MOST,RssDataType.REDDIT_NSFW -> {
RssDataType.REDDIT_NSFW,RssDataType.PRIVATE -> {
v.findViewById<ShapeableImageView>(R.id.circle_preview)?.let {
if (it.visibility == View.GONE) {
it.visibility = View.VISIBLE
it.postDelayed({
it.visibility = View.GONE
}, 2000L)
if (RssDataType.PRIVATE.equals(rss.category()) && imageView) {
openGecko("")
} else {
if (RssDataType.REDDIT_NSFW.equals(rss.category())) {
openReddit(rss.originPage())
if (it.visibility == View.GONE) {
it.visibility = View.VISIBLE
it.postDelayed({
it.visibility = View.GONE
}, 2000L)
} else {
openGecko(rss.originPage())
if (RssDataType.REDDIT_NSFW.equals(rss.category())) {
openReddit(rss.originPage())
} else if (RssDataType.PRIVATE.equals(rss.category())) {
startActivity(Intent().apply {
action = Intent.ACTION_VIEW
data = Uri.parse(rss.originPage)
})
} else {
openGecko(rss.originPage())
}
}
}
}
@ -234,16 +255,38 @@ internal class RssHome : Fragment() {
}
fun openGecko(originPage: String) {
rssId = originPage
targetList.clear()
if (!imageView) {
rssId = originPage
targetList.clear()
var setString = hashSetOf<String>()
setString.addAll(rssList)
setString.removeAll { it.equals(rssId) }
var setString = hashSetOf<String>()
setString.addAll(rssList)
setString.removeAll { it.equals(rssId) }
targetList.addAll(setString)
binding.geckoWeb.loadUrl(rssId)
binding.vote.visibility = binding.geckoWeb.visibility
targetList.addAll(setString)
binding.geckoWeb.loadUrl(rssId)
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
lasted?.removeFirst()?.let {
binding.layoutRssSummary.root.visibility = View.VISIBLE
binding.layoutRssSummary.title.text = it.title()
binding.layoutRssSummary.desc.text = it.description()
binding.layoutRssSummary.link.text = it.originPage()
loadImage(binding.layoutRssSummary.cover,it.thumbnailUrl())
loadImage(binding.layoutRssSummary.screen,it.getScreen())
}
}
// targetList.clear()
// lasted?.forEach {
// it.thumbnail?.let {
// targetList.add(it)
// }
// }
// rssId = targetList.removeAt(0)
// binding.geckoWeb.loadUrl(rssId)
}
}
@SuppressLint("ClickableViewAccessibility")
@ -274,6 +317,14 @@ internal class RssHome : Fragment() {
vote()
}
}
binding.test.setOnClickListener {
if(binding.geckoWeb.isVisible) {
binding.geckoWeb.visibility = View.GONE
}
binding.geckoWeb.visibility = View.GONE
binding.geckoWeb.loadUrl("aHR0cHM6Ly9pamF2dG9ycmVudC5jb20=")
}
binding.hide.setOnClickListener {
if (binding.geckoWeb.isVisible) {
@ -297,14 +348,18 @@ internal class RssHome : Fragment() {
if (binding.geckoWeb.isVisible) {
binding.geckoWeb.visibility = View.GONE
}
binding.layoutRssSummary.root.visibility = View.GONE
queryInfos()
}
binding.bookmark.setOnClickListener {
binding.layoutRssSummary.root.visibility = View.GONE
queryVotes()
}
binding.prv.setOnClickListener {
queryPrevate()
}
queryInfos()
binding.geckoWeb.progress = binding.progressBar
binding.geckoWeb.jxInteface = { jxEvent ->
@ -334,7 +389,7 @@ internal class RssHome : Fragment() {
Blog.LOGE("Arrow Center Click")
WorkersDb.getRealm().apply {
writeBlocking {
val result = query<RssData>().query("originPage == $0", rssId).find()
val result = query<RssData>().query(if(imageView)"thumbnail == $0" else "originPage == $0", rssId).find()
if (result.size > 0) {
result.forEach { it.vote = true }
}
@ -348,10 +403,10 @@ internal class RssHome : Fragment() {
fun doNextPage() {
WorkersDb.getRealm().apply {
writeBlocking {
val result = query<RssData>().query("originPage == $0", rssId).find()
val result = query<RssData>().query(if(imageView)"thumbnail == $0" else "originPage == $0", rssId).find()
if (result.size > 0) {
result.forEach {
it.read = it.read + nomoreShowCount
it.read = it.read + nomoreShowCount
}
}
}
@ -393,14 +448,14 @@ internal class RssHome : Fragment() {
is InitialResults -> {
commandHandler.removeCallbacks(infoUpdate)
WorkersDb.getRealm().apply {
lasted = copyFromRealm(changes.list)
lasted.clear()
lasted.addAll(copyFromRealm(changes.list))
}
commandHandler.post(infoUpdate)
}
is UpdatedResults -> {
CoroutineScope(Dispatchers.Main).launch {
changes.changeRanges.forEach {
changes.changeRanges.forEach {
mRssAdapter.notifyItemRangeChanged(it.startIndex, it.length)
}
}
@ -412,19 +467,25 @@ internal class RssHome : Fragment() {
infosJob?.start()
}
}
fun queryPrevate() {
imageView = true
beforeQuery()
updateQuery(WorkersDb.getPrivate())
}
fun queryVotes() {
imageView = false
beforeQuery()
updateQuery(WorkersDb.getVotedRss())
}
var imageView = false
fun queryInfos(
filter: Collection<RssDataType>? = arrayListOf(RssDataType.GURU, RssDataType.MOST,RssDataType.REDDIT_NSFW), noLimit: Boolean = false
filter: Collection<RssDataType>? = arrayListOf(RssDataType.REDDIT_NSFW,RssDataType.PRIVATE), noLimit: Boolean = false
) {
imageView = false
beforeQuery()
var rQ = WorkersDb.getRealm().query<RssData>().query("read < $0", nomoreShowCount).distinct("originPage", "title")
if (!noLimit) rQ.query("pubDate > $0", beforeOneDay())
// ((filter?.size ?: 0) > 0).letTrue {filter!!.forEach {rQ = rQ.query("category != $0", it.name)}}
((filter?.size ?: 0) > 0).letTrue {filter!!.forEach {rQ = rQ.query("category != $0", it.name)}}
updateQuery(rQ)
}
@ -445,16 +506,16 @@ internal class RssHome : Fragment() {
Blog.LOGE("onViewCreated()")
fragManager.addOnBackStackChangedListener {
Blog.LOGE("addOnBackStackChangedListener()")
shouldResume = if (fragManager.backStackEntryCount == 0) {
binding.root.visibility = View.VISIBLE
true
} else {
binding.root.visibility = View.GONE
false
}
}
// fragManager.addOnBackStackChangedListener {
// Blog.LOGE("addOnBackStackChangedListener()")
// shouldResume = if (fragManager.backStackEntryCount == 0) {
// binding.root.visibility = View.VISIBLE
// true
// } else {
// binding.root.visibility = View.GONE
// false
// }
// }
enableSwipeToDeleteAndUndo()
}
@ -530,5 +591,21 @@ internal class RssHome : Fragment() {
}
@BindingAdapter("imageUrl")
fun loadImage(imageView: ImageView, url: String?) {
url?.let {
if (it.length > 4) {
Blog.LOGE("loadImage >>> $it")
Glide.with(imageView.context)
.load(url)
.fitCenter()
.into(imageView)
imageView.visibility = View.VISIBLE
} else {
imageView.visibility = View.GONE
}
} ?: {
imageView.visibility = View.GONE
}
}

View File

@ -219,8 +219,8 @@ internal class RssItemAdapter (
v: View,
event: MotionEvent
): Boolean {
Blog.LOGE("event.device.name >>> ${event.device.name}")
if (event.device.name?.contains("JX-12",true) == true|| event.device.name?.equals("J06",true) == true) {
if (event.device != null && event.device.name != null && (event.device.name?.contains("JX-12",true) == true|| event.device.name?.equals("J06",true) == true)) {
Blog.LOGE("event.device.name >>> ${event.device.name}")
return true//mSimpleFingerGestures.onTouch(v,event)
} else {
return false

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<jGuruTag>,
private val context: Context) : RecyclerView.Adapter<RssTagAdapter.RssTag>() {
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<jGuruTag>) {
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 <http://www.gnu.org/licenses/>.
// */
//
// 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<jGuruTag>,
// private val context: Context) : RecyclerView.Adapter<RssTagAdapter.RssTag>() {
//
// 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<jGuruTag>, private val newList: List<jGuruTag>
) : 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<jGuruTag>) {
// 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<jGuruTag>, private val newList: List<jGuruTag>
//) : 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
//}

View File

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

View File

@ -1,5 +1,6 @@
package bums.lunatic.launcher.model
import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.utils.JamoUtils
import bums.lunatic.launcher.utils.afterDay
import bums.lunatic.launcher.utils.beforeDayBy
@ -218,6 +219,12 @@ class RssData : RealmObject, RssDataInterface {
var thumbnail : String? = null
var pubDate : Long = 0L
var category : String? = null
var magnet : String? = null
var screenshots : String? = null
fun getScreen() : String {
Blog.LOGE("getScreen $screenshots")
return screenshots ?: ""
}
var chosung : String? = null
var vote : Boolean = false
@ -232,15 +239,18 @@ class RssData : RealmObject, RssDataInterface {
}
else -> title ?: ""
}.apply {
Blog.LOGE("title $this")
chosung = JamoUtils.split(title).joinToString("")
}
}
override fun thumbnailUrl(): String {
Blog.LOGE("thumbnail $thumbnail")
return thumbnail ?: ""
}
override fun originPage(): String {
Blog.LOGE("originPage $originPage")
return originPage ?: ""
}

View File

@ -6,10 +6,11 @@ import bums.lunatic.launcher.helpers.PrefHelper
enum class RssDataType {
NO_DATA,
PRIVATE,
YOUTUBE,
NEWSFEED,
GURU,
MOST,
// GURU,
// MOST,
TAGS,
REDDIT,
REDDIT_NSFW,
@ -35,24 +36,28 @@ enum class RssDataType {
fun defaultImgSize() = when (this) {
YOUTUBE -> 200
REDDIT_NSFW,GURU,MOST -> 360
REDDIT_NSFW,PRIVATE -> 360
//,GURU,MOST
else -> { 120 }
}
fun getDefaultVisibiliy() = when (this) {
REDDIT_NSFW,GURU,MOST,NEWSFEED -> View.GONE
//,GURU,MOST
REDDIT_NSFW,PRIVATE -> 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
}
}

View File

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

View File

@ -1,5 +1,6 @@
package bums.lunatic.launcher.tokiz.data.model
import bums.lunatic.launcher.model.RssData
import io.realm.kotlin.ext.realmListOf
import io.realm.kotlin.types.RealmList
import io.realm.kotlin.types.RealmObject
@ -10,6 +11,8 @@ class PortMessage {
var bookInfos : PageInfosJ? = null
var book : BookContents? = null
var msg : String? = null
var contents : String? = null
var privates : ArrayList<RssData>? = null
}
class BookContents {
var chapterTitle : String? = null

View File

@ -12,6 +12,7 @@ import bums.lunatic.launcher.tokiz.common.TouchArea
import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.utils.SimpleFingerGestures
import org.mozilla.geckoview.GeckoView
import java.util.Base64
enum class JxEvent {
SCROLL_UP,
@ -160,14 +161,19 @@ open class BWebview : GeckoView {
var lastDomain : String = ""
fun loadUrl(url: String) {
var nUrl = url
Blog.LOGE("url >>>> ${url}")
if (url.endsWith("=")) {
nUrl = String(Base64.getMimeDecoder().decode(url.toByteArray()))
} else if (url.startsWith("http") == false) {
nUrl = lastDomain
}
if (this.isVisible == false) {
this.visibility = View.VISIBLE
}
Blog.LOGE("url >>>> ${url}")
var nUrl = url
if (url.startsWith("http") == false) {
nUrl = lastDomain
}
Blog.LOGE("nUrl >>>> ${nUrl}")
nUrl?.let { url ->
if (url.split("//").size > 1) {
url.replace("//","/").replace("https:/","https://").let {

View File

@ -8,6 +8,14 @@ import android.provider.ContactsContract.PhoneLookup
import java.util.Calendar
import java.util.Date
fun afterDay(date: Long): Long {
val cal: Calendar = Calendar.getInstance()
cal.setTime(Date(date))
cal.add(Calendar.HOUR_OF_DAY, 23)
cal.add(Calendar.MINUTE, 53)
return cal.timeInMillis
}
fun before30Min(date: Date): Long {
val cal: Calendar = Calendar.getInstance()
cal.setTime(date)

View File

@ -1,7 +1,6 @@
package bums.lunatic.launcher.utils
import bums.lunatic.launcher.home.RssHome.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<RssData>("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<RssData>("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<RssData>("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<RssData>("category == $0", RssDataType.GURU.name).find().size}")
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -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("웃긴")
) {

View File

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

View File

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

View File

@ -23,6 +23,7 @@ import bums.lunatic.launcher.model.LocationLog
import bums.lunatic.launcher.model.NotificationItem
import bums.lunatic.launcher.model.RssData
import bums.lunatic.launcher.model.RssDataInterface
import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.TelegramBotUpdate
import bums.lunatic.launcher.model.TelegramChat
import bums.lunatic.launcher.model.TelegramData
@ -33,6 +34,7 @@ import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.utils.JamoUtils
import bums.lunatic.launcher.utils.beforeDay
import bums.lunatic.launcher.utils.beforeOneDay
import com.google.gson.Gson
import io.realm.kotlin.Realm
import io.realm.kotlin.RealmConfiguration
import io.realm.kotlin.UpdatePolicy
@ -86,9 +88,21 @@ object WorkersDb {
getRealm().apply {
this.writeBlocking {
try {
if (query<RssData>("originPage == $0", rssData.originPage).find().isEmpty()) {
this.copyToRealm(rssData, UpdatePolicy.ERROR)
if (rssData.category().equals(RssDataType.PRIVATE)) {
this.copyToRealm(rssData, UpdatePolicy.ALL)
Blog.LOGE("rssData >> $rssData ${rssData.getScreen()}")
} else {
if (query<RssData>("originPage == $0", rssData.originPage).find()
.isEmpty()
) {
this.copyToRealm(rssData, UpdatePolicy.ERROR)
}
}
try {
query<RssData>("originPage == $0",rssData.originPage).find()?.first()?.let {
Blog.LOGE("SAVED CHECK ${Gson().toJson(this.copyFromRealm(it))}")
}
}catch (e: Exception) {e.printStackTrace()}
} catch (e : Exception) {
}
@ -212,6 +226,9 @@ object WorkersDb {
}
}
fun getPrivate() = getRealm().query<RssData>().query("category == $0 ",
RssDataType.PRIVATE.name).distinct("originPage", "title").sort("pubDate", Sort.DESCENDING)
fun getVotedRss() = getRealm().query<RssData>().query("vote == $0", true).distinct("originPage", "title")
fun getDeleteQuery( ) : RealmQuery<RssData>{

View File

@ -7,6 +7,22 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageButton
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:id="@+id/test"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:visibility="visible"
android:background="@null"
android:src="@drawable/ic_search"
android:layout_width="40dp"
android:tint="@color/white"
android:foregroundTint="@color/white"
tools:ignore="ContentDescription,UseAppTint"
android:layout_height="40dp" />
<ImageButton
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"
@ -61,6 +77,20 @@
android:adjustViewBounds="true"
tools:ignore="ContentDescription"
android:layout_height="40dp"/>
<ImageButton
android:layout_marginLeft="10dp"
android:id="@+id/prv"
app:layout_constraintBottom_toBottomOf="@id/bookmark"
app:layout_constraintLeft_toRightOf="@id/bookmark"
android:src="@drawable/bookmark"
android:scaleType="fitCenter"
android:background="@null"
android:layout_width="10dp"
android:alpha="0.2"
android:tint="@color/finestSilver"
android:adjustViewBounds="true"
tools:ignore="ContentDescription"
android:layout_height="10dp"/>
<androidx.recyclerview.widget.RecyclerView
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
@ -89,6 +119,17 @@
app:layout_constraintTop_toBottomOf="@id/bookmark"
android:layout_height="0dp"
/>
<include layout="@layout/layout_rss_summary"
android:id="@+id/layout_rss_summary"
android:layout_width="match_parent"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/bookmark"
android:layout_height="0dp"/>
<ProgressBar
app:layout_constraintTop_toTopOf="@id/geckoWeb"
app:layout_constraintLeft_toLeftOf="@id/geckoWeb"

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<import type="bums.lunatic.launcher.model.RssData"/>
<variable
name="rss"
type="bums.lunatic.launcher.model.RssData" />
</data>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="UselessParent">
<LinearLayout
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/title"
android:singleLine="false"
android:lines="0"
android:background="#000"
android:textSize="@dimen/_20sp"
android:textColor="@color/white"
android:layout_width="match_parent"
android:layout_height="150dp"/>
<ImageView
android:alpha="0.05"
android:id="@+id/cover"
android:adjustViewBounds="true"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/desc"
android:singleLine="false"
android:lines="0"
android:background="#000"
android:textSize="@dimen/_20sp"
android:textColor="@color/white"
android:layout_width="match_parent"
android:layout_height="150dp"/>
<ImageView
android:id="@+id/screen"
android:alpha="0.05"
android:adjustViewBounds="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/link"
android:singleLine="false"
android:lines="0"
android:background="#000"
android:textSize="@dimen/_20sp"
android:textColor="@color/white"
android:layout_width="match_parent"
android:layout_height="150dp"/>
</LinearLayout>
</ScrollView>
</FrameLayout>
</layout>