..
This commit is contained in:
@@ -36,7 +36,9 @@ 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 bums.lunatic.launcher.workers.WorkersDb.getRealm
|
||||
import com.google.gson.Gson
|
||||
import io.realm.kotlin.UpdatePolicy
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
import org.jsoup.Jsoup
|
||||
@@ -472,9 +474,14 @@ class GeckoWeb : BWebview {
|
||||
}
|
||||
"PRIVATES"->{
|
||||
lPortMessage.privates?.forEach {
|
||||
Blog.LOGE("Item screenshots >>> ${it.screenshots}")
|
||||
Blog.LOGE("Item screenshots >>> ${it.getScreen()}")
|
||||
it.pubDate = afterDay(it.pubDate)
|
||||
WorkersDb.insertData(it)
|
||||
// WorkersDb.insertData(it)
|
||||
getRealm().apply {
|
||||
this.writeBlocking {
|
||||
copyToRealm(it, UpdatePolicy.ALL)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"PagerContents" -> {
|
||||
|
||||
@@ -59,8 +59,11 @@ 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 bums.lunatic.launcher.workers.WorkersDb.prvClear
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import com.google.android.material.imageview.ShapeableImageView
|
||||
import com.google.gson.Gson
|
||||
import io.realm.kotlin.UpdatePolicy
|
||||
import io.realm.kotlin.ext.query
|
||||
import io.realm.kotlin.notifications.InitialResults
|
||||
@@ -268,13 +271,34 @@ internal class RssHome : Fragment() {
|
||||
} 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())
|
||||
if (lasted.size > 0) {
|
||||
lasted?.removeFirst()?.let {
|
||||
Blog.LOGE("removeFirst >>> ${Gson().toJson(it)}")
|
||||
binding.layoutRssSummary.root.visibility = View.VISIBLE
|
||||
it.title()?.let {
|
||||
Blog.LOGE(it)
|
||||
binding.layoutRssSummary.title.text = it
|
||||
}
|
||||
|
||||
it.description()?.let {
|
||||
Blog.LOGE(it)
|
||||
binding.layoutRssSummary.desc.text = it
|
||||
}
|
||||
it.getMagnet().let {
|
||||
Blog.LOGE(it)
|
||||
binding.layoutRssSummary.link.text = it
|
||||
}
|
||||
it.thumbnailUrl().let {
|
||||
Blog.LOGE(it)
|
||||
loadImage(binding.layoutRssSummary.cover, it)
|
||||
}
|
||||
it.getScreen().let {
|
||||
Blog.LOGE(it)
|
||||
loadImage(binding.layoutRssSummary.screen, it)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
binding.home.performClick()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,6 +384,10 @@ internal class RssHome : Fragment() {
|
||||
binding.prv.setOnClickListener {
|
||||
queryPrevate()
|
||||
}
|
||||
binding.layoutRssSummary.close.setOnClickListener {
|
||||
binding.home.performClick()
|
||||
}
|
||||
|
||||
queryInfos()
|
||||
binding.geckoWeb.progress = binding.progressBar
|
||||
binding.geckoWeb.jxInteface = { jxEvent ->
|
||||
@@ -598,14 +626,15 @@ fun loadImage(imageView: ImageView, url: String?) {
|
||||
Blog.LOGE("loadImage >>> $it")
|
||||
Glide.with(imageView.context)
|
||||
.load(url)
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.fitCenter()
|
||||
.into(imageView)
|
||||
imageView.visibility = View.VISIBLE
|
||||
} else {
|
||||
imageView.visibility = View.GONE
|
||||
imageView.visibility = View.INVISIBLE
|
||||
}
|
||||
} ?: {
|
||||
imageView.visibility = View.GONE
|
||||
imageView.visibility = View.INVISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,14 @@ class Clien : DcInside() {
|
||||
|
||||
}
|
||||
class Arca : RssDataInterface {
|
||||
override fun getScreen(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getMagnet(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
var link : String? = null
|
||||
var title : String? = null
|
||||
var thumbnail : String? = null
|
||||
@@ -160,6 +168,14 @@ open class DcInside : RssDataInterface {
|
||||
return desc ?: ""
|
||||
}
|
||||
|
||||
override fun getScreen(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getMagnet(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun pubDate(): Long {
|
||||
if (dateTiemL < 1L) {
|
||||
if (dateTiem?.length ?: 0 < 1) return 0L
|
||||
@@ -219,11 +235,15 @@ 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 magnet_link : String? = null
|
||||
var screenshotsUrl : String? = null
|
||||
|
||||
override fun getScreen() : String {
|
||||
return screenshotsUrl ?: ""
|
||||
}
|
||||
|
||||
override fun getMagnet(): String {
|
||||
return magnet_link ?: ""
|
||||
}
|
||||
|
||||
var chosung : String? = null
|
||||
@@ -239,18 +259,15 @@ 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 ?: ""
|
||||
}
|
||||
|
||||
@@ -288,6 +305,13 @@ open class Dotax(var pageLink : String,
|
||||
var dateTime : String,
|
||||
var title : String,
|
||||
var thumbnail : String) : RssDataInterface {
|
||||
override fun getScreen(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getMagnet(): String {
|
||||
return ""
|
||||
}
|
||||
var updateDateTime = 0L
|
||||
override fun title(): String {
|
||||
return title
|
||||
|
||||
@@ -3,7 +3,13 @@ package bums.lunatic.launcher.model
|
||||
import bums.lunatic.launcher.utils.JamoUtils
|
||||
|
||||
class NewsData : RssDataInterface {
|
||||
override fun getScreen(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getMagnet(): String {
|
||||
return ""
|
||||
}
|
||||
var title : String? = ""
|
||||
var link : String? = ""
|
||||
var guid : String? = ""
|
||||
|
||||
@@ -69,4 +69,6 @@ interface RssDataInterface {
|
||||
fun pubDate() : Long
|
||||
fun category() : RssDataType
|
||||
fun getCho() : String?
|
||||
fun getScreen() : String
|
||||
fun getMagnet() : String
|
||||
}
|
||||
@@ -124,6 +124,13 @@ class CrosspostParentList {
|
||||
}
|
||||
|
||||
class Data : RssDataInterface {
|
||||
override fun getScreen(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getMagnet(): String {
|
||||
return ""
|
||||
}
|
||||
var after: String? = null
|
||||
var dist: Int = 0
|
||||
var modhash: String? = null
|
||||
|
||||
@@ -506,6 +506,13 @@ class GridChannelRenderer {
|
||||
}
|
||||
|
||||
class GridVideoRenderer : VideoRenderer() {
|
||||
override fun getScreen(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getMagnet(): String {
|
||||
return ""
|
||||
}
|
||||
// var videoId: String? = null
|
||||
// var thumbnail: Thumbnail? = null
|
||||
// var title: Title? = null
|
||||
@@ -1567,6 +1574,13 @@ class VideoCountText {
|
||||
}
|
||||
|
||||
open class VideoRenderer : RssDataInterface {
|
||||
override fun getScreen(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getMagnet(): String {
|
||||
return ""
|
||||
}
|
||||
var videoId: String? = null
|
||||
var thumbnail: Thumbnail? = null
|
||||
var title: Title? = null
|
||||
|
||||
@@ -51,15 +51,16 @@ import java.util.regex.Pattern
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
class CustMigration : AutomaticSchemaMigration {
|
||||
override fun migrate(migrationContext: AutomaticSchemaMigration.MigrationContext) {
|
||||
Blog.LOGE(migrationContext.oldRealm.configuration.schemaVersion.toString())
|
||||
Blog.LOGE(migrationContext.newRealm.configuration.schemaVersion.toString())
|
||||
}
|
||||
}
|
||||
override fun migrate(migrationContext: AutomaticSchemaMigration.MigrationContext) {
|
||||
Blog.LOGE(migrationContext.oldRealm.configuration.schemaVersion.toString())
|
||||
Blog.LOGE(migrationContext.newRealm.configuration.schemaVersion.toString())
|
||||
}
|
||||
}
|
||||
object WorkersDb {
|
||||
|
||||
|
||||
val clazz : Set<KClass<out BaseRealmObject>> = setOf(RssData::class, NotificationItem::class, AppInfo::class,SimpleContact::class, RecentCall::class, RecentSms::class, CurrentPlayItem::class,
|
||||
val clazz : Set<KClass<out BaseRealmObject>> = setOf(
|
||||
RssData::class, NotificationItem::class, AppInfo::class,SimpleContact::class, RecentCall::class, RecentSms::class, CurrentPlayItem::class,
|
||||
TelegramBotUpdate::class, TelegramData::class, TelegramMessage::class, TelegramChat::class, BotCommandEentitie::class, TelegramFrom::class,
|
||||
WeatherForcast::class, Location::class, Current::class, Forecast::class, Condition::class, Forecastday::class, Day::class, Astro::class, Hour::class,
|
||||
LocationLog::class,
|
||||
@@ -88,21 +89,11 @@ object WorkersDb {
|
||||
getRealm().apply {
|
||||
this.writeBlocking {
|
||||
try {
|
||||
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)
|
||||
}
|
||||
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) {
|
||||
|
||||
}
|
||||
@@ -110,7 +101,7 @@ object WorkersDb {
|
||||
}
|
||||
}
|
||||
|
||||
// val blockKeyword = arrayListOf<String>("붕괴 스타레일","붕괴 스타일","트릭컬 RE:VIVE","원신","메이플스토리","")
|
||||
// val blockKeyword = arrayListOf<String>("붕괴 스타레일","붕괴 스타일","트릭컬 RE:VIVE","원신","메이플스토리","")
|
||||
fun insertBulkData(rssDatas: Collection<RssData>) {
|
||||
rssDatas.forEach {
|
||||
try {
|
||||
@@ -120,7 +111,7 @@ object WorkersDb {
|
||||
if (query<RssData>("originPage == $0", t.originPage).find().isEmpty()) {
|
||||
// val catfillters = arrayListOf<RssDataType>(RssDataType.THEQOO,RssDataType.RULIWEB,RssDataType.ARCA,RssDataType.CLIEN,RssDataType.FMKORAE,RssDataType.DOTAX,RssDataType.DCINSIDE)
|
||||
// if(catfillters.contains(it.category()) && query<RssData>("chosung == $0",it.chosung).find().size == 0) {
|
||||
this.copyToRealm(t, UpdatePolicy.ERROR)
|
||||
this.copyToRealm(t, UpdatePolicy.ERROR)
|
||||
// } else if(!catfillters.contains(it.category())){
|
||||
// this.copyToRealm(it, UpdatePolicy.ERROR)
|
||||
// } else {
|
||||
@@ -188,7 +179,7 @@ object WorkersDb {
|
||||
try {
|
||||
this.copyToRealm(contact, UpdatePolicy.ALL)
|
||||
} catch (e : Exception) {
|
||||
e.printStackTrace()
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -225,7 +216,13 @@ object WorkersDb {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun prvClear() {
|
||||
getRealm().writeBlocking {
|
||||
var results = query<RssData>().query("category == $0 ",
|
||||
RssDataType.PRIVATE.name).find()
|
||||
delete(results)
|
||||
}
|
||||
}
|
||||
fun getPrivate() = getRealm().query<RssData>().query("category == $0 ",
|
||||
RssDataType.PRIVATE.name).distinct("originPage", "title").sort("pubDate", Sort.DESCENDING)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user