...
This commit is contained in:
parent
8c87f33ef2
commit
3813a4293b
@ -107,6 +107,7 @@ import rasel.lunar.launcher.workers.RedditGetter
|
|||||||
import rasel.lunar.launcher.workers.WorkersDb
|
import rasel.lunar.launcher.workers.WorkersDb
|
||||||
import rasel.lunar.launcher.workers.YoutubeGetter
|
import rasel.lunar.launcher.workers.YoutubeGetter
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Calendar
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
@ -500,16 +501,21 @@ internal class LauncherActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var callBack : (()->Unit)? = null
|
var callBack : (()->Unit)? = null
|
||||||
|
var isF = false
|
||||||
fun doWebParseStart(url : String, callBack : (()->Unit)?) {
|
fun doWebParseStart(url : String, callBack : (()->Unit)?) {
|
||||||
|
isF = true
|
||||||
this.callBack = callBack
|
this.callBack = callBack
|
||||||
binding.searcher01.post { binding.searcher01.visibility = View.VISIBLE }
|
binding.searcher01.post { binding.searcher01.visibility = View.VISIBLE }
|
||||||
BLog.LOGE("binding.otherCheck before ThreadRun")
|
BLog.LOGE("binding.otherCheck before ThreadRun")
|
||||||
binding.searcher01.webViewClient = object : WebViewClient() {
|
binding.searcher01.webViewClient = object : WebViewClient() {
|
||||||
|
|
||||||
// override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
|
override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
|
||||||
//// view?.loadUrl(url!!)
|
if (!isF && url?.contains("missav") == true) {
|
||||||
// return false
|
view?.loadUrl(url!!)
|
||||||
// }
|
isF = true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
|
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
|
||||||
BLog.LOGE("binding.otherCheck searcher01 in onPageStarted ${url}")
|
BLog.LOGE("binding.otherCheck searcher01 in onPageStarted ${url}")
|
||||||
@ -531,11 +537,13 @@ internal class LauncherActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
override fun onPageFinished(view: WebView?, url: String?) {
|
override fun onPageFinished(view: WebView?, url: String?) {
|
||||||
super.onPageFinished(view, url)
|
super.onPageFinished(view, url)
|
||||||
lastedFinishedPageUrl = url ?: ""
|
lastedFinishedPageUrl = url ?: ""
|
||||||
BLog.LOGE("binding.otherCheck searcher01 in onPageFinished ${url}")
|
BLog.LOGE("binding.otherCheck searcher01 in onPageFinished ${url}")
|
||||||
if(lastedFinishedPageUrl?.length ?: 0 > 10 && url?.contains("data:text") == false) {
|
//lastedFinishedPageUrl?.length ?: 0 > 10 &&
|
||||||
|
// if(url?.startsWith("https://") == true) {
|
||||||
if (url?.contains("youtube", false) == true) {
|
if (url?.contains("youtube", false) == true) {
|
||||||
view?.evaluateJavascript(
|
view?.evaluateJavascript(
|
||||||
"function getAll() {\n" +
|
"function getAll() {\n" +
|
||||||
@ -557,10 +565,16 @@ internal class LauncherActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// if (!isF) {
|
||||||
|
// binding.searcher01.post {
|
||||||
|
// binding.searcher01.loadUrl("https://missav.com/dm11/ko")
|
||||||
|
// isF = true
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
callBack?.invoke()
|
// callBack?.invoke()
|
||||||
binding.searcher01.post { binding.searcher01.visibility = View.GONE }
|
// binding.searcher01.post { binding.searcher01.visibility = View.GONE }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WebView.setWebContentsDebuggingEnabled(false)
|
WebView.setWebContentsDebuggingEnabled(false)
|
||||||
@ -577,7 +591,7 @@ internal class LauncherActivity : AppCompatActivity() {
|
|||||||
setLayerType(View.LAYER_TYPE_SOFTWARE, null) // 랜더링 이슈 해결
|
setLayerType(View.LAYER_TYPE_SOFTWARE, null) // 랜더링 이슈 해결
|
||||||
try {
|
try {
|
||||||
settings.apply {
|
settings.apply {
|
||||||
// userAgentString = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"
|
userAgentString = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"
|
||||||
javaScriptEnabled = true // 자바스크립트 사용 가능하도록 설정
|
javaScriptEnabled = true // 자바스크립트 사용 가능하도록 설정
|
||||||
loadWithOverviewMode = true // 전체 웹페이지를 화면에 맞게 로드
|
loadWithOverviewMode = true // 전체 웹페이지를 화면에 맞게 로드
|
||||||
useWideViewPort = true // 화면에 맞게 페이지 확대/축소
|
useWideViewPort = true // 화면에 맞게 페이지 확대/축소
|
||||||
@ -726,7 +740,8 @@ internal class LauncherActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}.apply {
|
}.apply {
|
||||||
WorkersDb.insertBulkData(temp)
|
WorkersDb.insertBulkData(temp)
|
||||||
binding.searcher01?.post { binding.searcher01.loadData("<html></html>",null,null) }
|
// BLog.LOGE("temp >>> ${temp.size}")
|
||||||
|
// binding.searcher01?.post { binding.searcher01.loadData("<html></html>",null,null) }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -762,10 +777,17 @@ class MissD : RssDataInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun pubDate(): Long {
|
override fun pubDate(): Long {
|
||||||
return beforeDay(Date(),3) + 36000L
|
return beforeDay(Date())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun category(): RssDataType {
|
override fun category(): RssDataType {
|
||||||
return RssDataType.GURU
|
return RssDataType.GURU
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fun beforeDay(date: Date): Long {
|
||||||
|
val cal: Calendar = Calendar.getInstance()
|
||||||
|
cal.setTime(date)
|
||||||
|
cal.add(Calendar.DAY_OF_YEAR, -2)
|
||||||
|
cal.add(Calendar.HOUR, 8)
|
||||||
|
return cal.timeInMillis
|
||||||
|
}
|
||||||
@ -24,6 +24,7 @@ import android.appwidget.AppWidgetManager
|
|||||||
import android.content.DialogInterface
|
import android.content.DialogInterface
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
|
import android.net.Uri
|
||||||
import android.os.*
|
import android.os.*
|
||||||
import android.view.*
|
import android.view.*
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
@ -38,6 +39,7 @@ import androidx.lifecycle.repeatOnLifecycle
|
|||||||
import com.google.android.material.button.MaterialButtonToggleGroup
|
import com.google.android.material.button.MaterialButtonToggleGroup
|
||||||
import io.realm.kotlin.ext.query
|
import io.realm.kotlin.ext.query
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
|
import org.jsoup.Jsoup
|
||||||
import rasel.lunar.launcher.LauncherActivity.Companion.appWidgetHost
|
import rasel.lunar.launcher.LauncherActivity.Companion.appWidgetHost
|
||||||
import rasel.lunar.launcher.LauncherActivity.Companion.appWidgetManager
|
import rasel.lunar.launcher.LauncherActivity.Companion.appWidgetManager
|
||||||
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
|
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
|
||||||
@ -61,8 +63,11 @@ import rasel.lunar.launcher.model.RssTagItem
|
|||||||
import rasel.lunar.launcher.model.RssData
|
import rasel.lunar.launcher.model.RssData
|
||||||
import rasel.lunar.launcher.model.RssDataInterface
|
import rasel.lunar.launcher.model.RssDataInterface
|
||||||
import rasel.lunar.launcher.model.RssDataType
|
import rasel.lunar.launcher.model.RssDataType
|
||||||
|
import rasel.lunar.launcher.utils.BLog
|
||||||
import rasel.lunar.launcher.utils.RssList.jGuruMain
|
import rasel.lunar.launcher.utils.RssList.jGuruMain
|
||||||
import rasel.lunar.launcher.workers.WorkersDb
|
import rasel.lunar.launcher.workers.WorkersDb
|
||||||
|
import java.net.URLEncoder
|
||||||
|
import java.nio.charset.Charset
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
|
||||||
@ -137,7 +142,14 @@ internal class Feeds : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fun openOpera(schemeString : String) {
|
||||||
|
BLog.LOGE("openOpera ${schemeString}")
|
||||||
|
val gmmIntentUri = Uri.parse(schemeString)
|
||||||
|
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
|
||||||
|
mapIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
|
||||||
|
mapIntent.setPackage("com.opera.browser")
|
||||||
|
lActivity?.startActivity(mapIntent)
|
||||||
|
}
|
||||||
/* start rss service if network is active and rss url is not empty */
|
/* start rss service if network is active and rss url is not empty */
|
||||||
private fun startService() {
|
private fun startService() {
|
||||||
binding.feedsRss.rss.visibility = View.GONE
|
binding.feedsRss.rss.visibility = View.GONE
|
||||||
@ -153,32 +165,58 @@ internal class Feeds : Fragment() {
|
|||||||
builder.setPositiveButton(android.R.string.ok,
|
builder.setPositiveButton(android.R.string.ok,
|
||||||
DialogInterface.OnClickListener { dialog, which ->
|
DialogInterface.OnClickListener { dialog, which ->
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
when(input.text.toString()) {
|
if (input.text.toString().trim().contains(" ")) {
|
||||||
|
val cmd = input.text.toString().trim().split(" ")
|
||||||
|
when(cmd[0]) {
|
||||||
|
"miss"-> lActivity?.doWebParseStart("https://missav.com/ko/search/${input.text.toString().trim().split(" ")[1]}/") {}
|
||||||
|
"mgn"-> {
|
||||||
|
// lActivity?.doWebParseStart("https://cili.site/search?q=${URLEncoder.encode(cmd[1], Charset.defaultCharset().name())}") {}
|
||||||
|
GlobalScope.launch {
|
||||||
|
///https://cili.site/!iAVJ
|
||||||
|
Jsoup.connect("https://cili.site/search?q=${URLEncoder.encode(cmd[1], Charset.defaultCharset().name())}").get().apply {
|
||||||
|
BLog.LOGE("this >>>> cili ${this}")
|
||||||
|
}
|
||||||
|
}.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
when (input.text.toString()) {
|
||||||
|
|
||||||
"ytb" -> {
|
"ytb" -> {
|
||||||
refreshYoutube()
|
refreshYoutube()
|
||||||
}
|
}
|
||||||
"reddit"->{
|
|
||||||
|
"reddit" -> {
|
||||||
refreshReddit()
|
refreshReddit()
|
||||||
}
|
}
|
||||||
"fedd"->{
|
|
||||||
|
"fedd" -> {
|
||||||
refreshFeeds()
|
refreshFeeds()
|
||||||
}
|
}
|
||||||
"comic"->{
|
|
||||||
|
"comic" -> {
|
||||||
refreshComics()
|
refreshComics()
|
||||||
}
|
}
|
||||||
"taxi"-> {
|
|
||||||
|
"taxi" -> {
|
||||||
home?.showAl()
|
home?.showAl()
|
||||||
}
|
}
|
||||||
"tax"-> {
|
|
||||||
|
"tax" -> {
|
||||||
home?.hideAl()
|
home?.hideAl()
|
||||||
}
|
}
|
||||||
|
|
||||||
"jshow" -> {
|
"jshow" -> {
|
||||||
binding.feedsRss.apply {
|
binding.feedsRss.apply {
|
||||||
rss.adapter = mRssAdapter
|
rss.adapter = mRssAdapter
|
||||||
loading.visibility = View.VISIBLE
|
loading.visibility = View.VISIBLE
|
||||||
if (listItem.size > 0) {
|
if (listItem.size > 0) {
|
||||||
listItem.sortByDescending { it.pubDate() }
|
listItem.sortByDescending { it.pubDate() }
|
||||||
WorkersDb.getRealm().query<RssData>("category == '$0'", RssDataType.GURU.name).find()?.apply {
|
WorkersDb.getRealm()
|
||||||
|
.query<RssData>("category == '$0'", RssDataType.GURU.name)
|
||||||
|
.find()?.apply {
|
||||||
mRssAdapter?.updateData(listItem)
|
mRssAdapter?.updateData(listItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,29 +229,34 @@ internal class Feeds : Fragment() {
|
|||||||
refresh.setOnClickListener {
|
refresh.setOnClickListener {
|
||||||
var call = {
|
var call = {
|
||||||
if (listItem.size > 0) {
|
if (listItem.size > 0) {
|
||||||
rss?.postDelayed( {
|
rss?.postDelayed({
|
||||||
listItem.sortByDescending { it.pubDate() }
|
listItem.sortByDescending { it.pubDate() }
|
||||||
mRssAdapter?.updateData(listItem)
|
mRssAdapter?.updateData(listItem)
|
||||||
loading.visibility = View.GONE
|
loading.visibility = View.GONE
|
||||||
refresh.visibility = View.GONE
|
refresh.visibility = View.GONE
|
||||||
rss.visibility = View.VISIBLE
|
rss.visibility = View.VISIBLE
|
||||||
},500L)
|
}, 500L)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"jjp" -> {
|
"jjp" -> {
|
||||||
lActivity?.doWebParseStart("https://projectjav.com") {}
|
lActivity?.doWebParseStart("https://projectjav.com") {}
|
||||||
}
|
}
|
||||||
|
"jmnew" -> {
|
||||||
|
lActivity?.doWebParseStart("https://missav.com/dm511/ko/new") {}
|
||||||
|
}
|
||||||
"jmiss" -> {
|
"jmiss" -> {
|
||||||
lActivity?.doWebParseStart("https://missav.com/dm11/ko") {}
|
lActivity?.doWebParseStart("https://missav.com/dm11/ko") {}
|
||||||
}
|
}
|
||||||
"jreq" -> {
|
"jreq" -> {
|
||||||
lActivity?.doWebParseStart(jGuruMain) {}
|
lActivity?.doWebParseStart(jGuruMain) {}
|
||||||
}
|
}
|
||||||
"jtag"-> {
|
|
||||||
|
"jtag" -> {
|
||||||
// lActivity?.doWebPare(TEST_PAG.plus("tags")) {
|
// lActivity?.doWebPare(TEST_PAG.plus("tags")) {
|
||||||
|
|
||||||
binding.feedsRss.apply {
|
binding.feedsRss.apply {
|
||||||
@ -231,12 +274,12 @@ internal class Feeds : Fragment() {
|
|||||||
refresh.setOnClickListener {
|
refresh.setOnClickListener {
|
||||||
lActivity?.doWebParseStart(jGuruMain.plus("tags")) {
|
lActivity?.doWebParseStart(jGuruMain.plus("tags")) {
|
||||||
if (listTags.size > 0) {
|
if (listTags.size > 0) {
|
||||||
rss2?.postDelayed( {
|
rss2?.postDelayed({
|
||||||
mRssAdapter2?.updateData(listTags)
|
mRssAdapter2?.updateData(listTags)
|
||||||
loading.visibility = View.GONE
|
loading.visibility = View.GONE
|
||||||
refresh.visibility = View.GONE
|
refresh.visibility = View.GONE
|
||||||
rss2.visibility = View.VISIBLE
|
rss2.visibility = View.VISIBLE
|
||||||
},500L)
|
}, 500L)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -244,10 +287,12 @@ internal class Feeds : Fragment() {
|
|||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
binding.expandRss.isChecked = false
|
binding.expandRss.isChecked = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
builder.setNegativeButton(android.R.string.cancel,
|
builder.setNegativeButton(android.R.string.cancel,
|
||||||
|
|||||||
@ -152,7 +152,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
if (lastedNoti?.size ?: 0 > 0) {
|
if (lastedNoti?.size ?: 0 > 0) {
|
||||||
binding.otherCheck.text = "최근 정보[${lasted!!.size}]"
|
binding.otherCheck.text = "최근 정보[${lasted!!.size}]"
|
||||||
mRssAdapter.updateData(lasted!!)
|
mRssAdapter.updateData(lasted!!)
|
||||||
binding.infoList.smoothScrollToPosition(0)
|
// binding.infoList.smoothScrollToPosition(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,7 +464,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
if (lasted?.size ?: 0 > 0) {
|
if (lasted?.size ?: 0 > 0) {
|
||||||
binding.otherCheck.text = "최근 정보[${lasted!!.size}]"
|
binding.otherCheck.text = "최근 정보[${lasted!!.size}]"
|
||||||
mRssAdapter.updateData(lasted!!)
|
mRssAdapter.updateData(lasted!!)
|
||||||
binding.infoList.smoothScrollToPosition(0)
|
// binding.infoList.smoothScrollToPosition(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -477,7 +477,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
if (lastedNoti?.size ?: 0 > 0) {
|
if (lastedNoti?.size ?: 0 > 0) {
|
||||||
binding.otherCheck.text = "알림 센터[${lastedNoti!!.size}]"
|
binding.otherCheck.text = "알림 센터[${lastedNoti!!.size}]"
|
||||||
mNotiAdapter.updateData(lastedNoti!!)
|
mNotiAdapter.updateData(lastedNoti!!)
|
||||||
binding.notiList.smoothScrollToPosition(0)
|
// binding.notiList.smoothScrollToPosition(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -162,8 +162,8 @@ internal class RssItemAdapter (
|
|||||||
// false
|
// false
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
holder.view.title.setOnLongClickListener {
|
||||||
holder.view.root.setOnLongClickListener {
|
BLog.LOGE("holder.view.root ${holder.view.root}")
|
||||||
if ( todo.category().equals(RssDataType.GURU)) {
|
if ( todo.category().equals(RssDataType.GURU)) {
|
||||||
openOpera(todo.originPage())
|
openOpera(todo.originPage())
|
||||||
} else if( todo.category().equals(RssDataType.REDDIT)) {
|
} else if( todo.category().equals(RssDataType.REDDIT)) {
|
||||||
@ -173,6 +173,24 @@ internal class RssItemAdapter (
|
|||||||
}else if(todo.category().equals(RssDataType.FmKorae)|| todo.category().equals(
|
}else if(todo.category().equals(RssDataType.FmKorae)|| todo.category().equals(
|
||||||
RssDataType.DcInside)|| todo.category().equals(RssDataType.Arca)) {
|
RssDataType.DcInside)|| todo.category().equals(RssDataType.Arca)) {
|
||||||
openNews(todo.originPage())
|
openNews(todo.originPage())
|
||||||
|
} else {
|
||||||
|
openOpera(todo.originPage())
|
||||||
|
}
|
||||||
|
true
|
||||||
|
}
|
||||||
|
holder.view.root.setOnLongClickListener {
|
||||||
|
BLog.LOGE("holder.view.root ${holder.view.root}")
|
||||||
|
if ( todo.category().equals(RssDataType.GURU)) {
|
||||||
|
openOpera(todo.originPage())
|
||||||
|
} else if( todo.category().equals(RssDataType.REDDIT)) {
|
||||||
|
openReddit(todo.originPage())
|
||||||
|
} else if( todo.category().equals(RssDataType.Dotax)) {
|
||||||
|
openDotax(todo.originPage())
|
||||||
|
}else if(todo.category().equals(RssDataType.FmKorae)|| todo.category().equals(
|
||||||
|
RssDataType.DcInside)|| todo.category().equals(RssDataType.Arca)) {
|
||||||
|
openNews(todo.originPage())
|
||||||
|
} else {
|
||||||
|
openOpera(todo.originPage())
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
@ -181,6 +199,7 @@ internal class RssItemAdapter (
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun openOpera(schemeString : String) {
|
fun openOpera(schemeString : String) {
|
||||||
|
BLog.LOGE("openOpera ${schemeString}")
|
||||||
val gmmIntentUri = Uri.parse(schemeString)
|
val gmmIntentUri = Uri.parse(schemeString)
|
||||||
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
|
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
|
||||||
mapIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
|
mapIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user