This commit is contained in:
lunaticbum 2025-07-23 10:43:45 +09:00
parent 6cb5ea9b15
commit 2719b7d291
17 changed files with 414 additions and 359 deletions

View File

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

View File

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

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

@ -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<ShapeableImageView>(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<RssDataType>? = arrayListOf(RssDataType.GURU, RssDataType.MOST,RssDataType.REDDIT_NSFW), noLimit: Boolean = false
//RssDataType.GURU, RssDataType.MOST,
filter: Collection<RssDataType>? = arrayListOf(RssDataType.REDDIT_NSFW), noLimit: Boolean = false
) {
beforeQuery()
var rQ = WorkersDb.getRealm().query<RssData>().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() {

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

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

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