.
This commit is contained in:
parent
3813a4293b
commit
1ca2b360d7
@ -89,4 +89,5 @@ dependencies {
|
||||
implementation ("io.realm.kotlin:library-base:2.1.0")
|
||||
implementation ("org.jsoup:jsoup:1.18.1")
|
||||
implementation ("org.apache.commons:commons-text:1.12.0")
|
||||
implementation("com.squareup.okhttp:okhttp:2.7.5")
|
||||
}
|
||||
|
||||
@ -52,11 +52,14 @@
|
||||
android:stateNotNeeded="true"
|
||||
android:enableOnBackInvokedCallback="true"
|
||||
android:largeHeap="true"
|
||||
android:debuggable="false"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:hardwareAccelerated="true"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:screenOrientation="nosensor"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:requestLegacyExternalStorage="true">
|
||||
android:requestLegacyExternalStorage="true"
|
||||
>
|
||||
|
||||
<activity
|
||||
android:name=".LauncherActivity"
|
||||
|
||||
@ -503,16 +503,17 @@ internal class LauncherActivity : AppCompatActivity() {
|
||||
var callBack : (()->Unit)? = null
|
||||
var isF = false
|
||||
fun doWebParseStart(url : String, callBack : (()->Unit)?) {
|
||||
isF = true
|
||||
isF = false
|
||||
this.callBack = callBack
|
||||
binding.searcher01.post { binding.searcher01.visibility = View.VISIBLE }
|
||||
BLog.LOGE("binding.otherCheck before ThreadRun")
|
||||
binding.searcher01.webViewClient = object : WebViewClient() {
|
||||
|
||||
override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
|
||||
if (!isF && url?.contains("missav") == true) {
|
||||
if (url?.contains("missav") == true && isF) {
|
||||
BLog.LOGE("binding.otherCheck before reload")
|
||||
view?.loadUrl(url!!)
|
||||
isF = true
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
@ -544,35 +545,35 @@ internal class LauncherActivity : AppCompatActivity() {
|
||||
BLog.LOGE("binding.otherCheck searcher01 in onPageFinished ${url}")
|
||||
//lastedFinishedPageUrl?.length ?: 0 > 10 &&
|
||||
// if(url?.startsWith("https://") == true) {
|
||||
if (url?.contains("youtube", false) == true) {
|
||||
view?.evaluateJavascript(
|
||||
"function getAll() {\n" +
|
||||
" MyJavaScriptInterface.sendValueFromHtml(document.getElementsByTagName('html')[0].innerHTML)" +
|
||||
" };getAll()"
|
||||
) { result ->
|
||||
(result as? String)?.let {
|
||||
if (url?.contains("youtube", false) == true) {
|
||||
view?.evaluateJavascript(
|
||||
"function getAll() {\n" +
|
||||
" MyJavaScriptInterface.sendValueFromHtml(document.getElementsByTagName('html')[0].innerHTML)" +
|
||||
" };getAll()"
|
||||
) { result ->
|
||||
(result as? String)?.let {
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//if (url?.contains("guru", true) == true)
|
||||
view?.evaluateJavascript(
|
||||
"function getAll() {\n" +
|
||||
" MyJavaScriptInterface.sendValueFromHtml(document.getElementsByTagName('html')[0].innerHTML)" +
|
||||
" };getAll()"
|
||||
) { result ->
|
||||
(result as? String)?.let {
|
||||
}
|
||||
} else {
|
||||
//if (url?.contains("guru", true) == true)
|
||||
view?.evaluateJavascript(
|
||||
"function getAll() {\n" +
|
||||
" MyJavaScriptInterface.sendValueFromHtml(document.getElementsByTagName('html')[0].innerHTML)" +
|
||||
" };getAll()"
|
||||
) { result ->
|
||||
(result as? String)?.let {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (!isF) {
|
||||
// binding.searcher01.post {
|
||||
// binding.searcher01.loadUrl("https://missav.com/dm11/ko")
|
||||
// isF = true
|
||||
// }
|
||||
// }
|
||||
}
|
||||
// callBack?.invoke()
|
||||
}
|
||||
if (isF) this@LauncherActivity.callBack?.invoke()
|
||||
// binding.searcher01.post { binding.searcher01.visibility = View.GONE }
|
||||
// }
|
||||
}
|
||||
|
||||
@ -37,7 +37,13 @@ import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import com.google.android.material.button.MaterialButtonToggleGroup
|
||||
import com.squareup.okhttp.ConnectionPool
|
||||
import com.squareup.okhttp.OkHttpClient
|
||||
import com.squareup.okhttp.Request
|
||||
import com.squareup.okhttp.Response
|
||||
import com.squareup.okhttp.ResponseBody
|
||||
import io.realm.kotlin.ext.query
|
||||
import io.realm.kotlin.query.Sort
|
||||
import kotlinx.coroutines.*
|
||||
import org.jsoup.Jsoup
|
||||
import rasel.lunar.launcher.LauncherActivity.Companion.appWidgetHost
|
||||
@ -57,18 +63,19 @@ import rasel.lunar.launcher.helpers.Constants.Companion.SEPARATOR
|
||||
import rasel.lunar.launcher.helpers.Constants.Companion.requestCreateWidget
|
||||
import rasel.lunar.launcher.helpers.Constants.Companion.requestPickWidget
|
||||
import rasel.lunar.launcher.home.LauncherHome.Companion.home
|
||||
import rasel.lunar.launcher.home.LauncherHome.Companion.listItem
|
||||
import rasel.lunar.launcher.home.LauncherHome.Companion.listTags
|
||||
import rasel.lunar.launcher.model.RssTagItem
|
||||
import rasel.lunar.launcher.model.RssData
|
||||
import rasel.lunar.launcher.model.RssDataInterface
|
||||
import rasel.lunar.launcher.model.RssDataType
|
||||
import rasel.lunar.launcher.model.RssTagItem
|
||||
import rasel.lunar.launcher.utils.BLog
|
||||
import rasel.lunar.launcher.utils.RssList.jGuruMain
|
||||
import rasel.lunar.launcher.workers.WorkersDb
|
||||
import java.net.URLEncoder
|
||||
import java.nio.charset.Charset
|
||||
import java.util.*
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
||||
internal class Feeds : Fragment() {
|
||||
@ -150,6 +157,8 @@ internal class Feeds : Fragment() {
|
||||
mapIntent.setPackage("com.opera.browser")
|
||||
lActivity?.startActivity(mapIntent)
|
||||
}
|
||||
|
||||
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"
|
||||
/* start rss service if network is active and rss url is not empty */
|
||||
private fun startService() {
|
||||
binding.feedsRss.rss.visibility = View.GONE
|
||||
@ -168,7 +177,8 @@ internal class Feeds : Fragment() {
|
||||
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]}/") {}
|
||||
//lActivity?.doWebParseStart("https://missav.com/dm16/en") {}
|
||||
"miss"-> lActivity?.doWebParseStart("https://missav.com/en/search/${input.text.toString().trim().split(" ")[1]}/") {}
|
||||
"mgn"-> {
|
||||
// lActivity?.doWebParseStart("https://cili.site/search?q=${URLEncoder.encode(cmd[1], Charset.defaultCharset().name())}") {}
|
||||
GlobalScope.launch {
|
||||
@ -212,34 +222,12 @@ internal class Feeds : Fragment() {
|
||||
binding.feedsRss.apply {
|
||||
rss.adapter = mRssAdapter
|
||||
loading.visibility = View.VISIBLE
|
||||
if (listItem.size > 0) {
|
||||
listItem.sortByDescending { it.pubDate() }
|
||||
WorkersDb.getRealm()
|
||||
.query<RssData>("category == '$0'", RssDataType.GURU.name)
|
||||
.find()?.apply {
|
||||
mRssAdapter?.updateData(listItem)
|
||||
}
|
||||
|
||||
rss.visibility = View.VISIBLE
|
||||
loading.visibility = View.GONE
|
||||
refresh.visibility = View.GONE
|
||||
} else {
|
||||
refresh.visibility = View.VISIBLE
|
||||
rss.visibility = View.GONE
|
||||
refresh.setOnClickListener {
|
||||
var call = {
|
||||
if (listItem.size > 0) {
|
||||
rss?.postDelayed({
|
||||
listItem.sortByDescending { it.pubDate() }
|
||||
mRssAdapter?.updateData(listItem)
|
||||
loading.visibility = View.GONE
|
||||
refresh.visibility = View.GONE
|
||||
rss.visibility = View.VISIBLE
|
||||
}, 500L)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mRssAdapter?.updateData(WorkersDb.getRealm()
|
||||
.query<RssData>("category == $0", RssDataType.GURU.name)
|
||||
.sort("pubDate", Sort.DESCENDING).find())
|
||||
rss.visibility = View.VISIBLE
|
||||
loading.visibility = View.GONE
|
||||
refresh.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,10 +235,48 @@ internal class Feeds : Fragment() {
|
||||
lActivity?.doWebParseStart("https://projectjav.com") {}
|
||||
}
|
||||
"jmnew" -> {
|
||||
lActivity?.doWebParseStart("https://missav.com/dm511/ko/new") {}
|
||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
||||
try {
|
||||
val url = "https://missav.com/"
|
||||
|
||||
|
||||
// OkHttp 클라이언트 객체 생성
|
||||
val client: OkHttpClient = OkHttpClient()
|
||||
client.connectionPool = ConnectionPool(10, 300, TimeUnit.SECONDS)
|
||||
client.setFollowSslRedirects(true)
|
||||
|
||||
// GET 요청 객체 생성
|
||||
val builder: Request.Builder = Request.Builder().url(url).get()
|
||||
// builder.addHeader("password", "BlahBlah")
|
||||
val request: Request = builder.build()
|
||||
|
||||
|
||||
// OkHttp 클라이언트로 GET 요청 객체 전송
|
||||
val response: Response = client.newCall(request).execute()
|
||||
if (response.isSuccessful()) {
|
||||
// 응답 받아서 처리
|
||||
val body: ResponseBody = response.body()
|
||||
if (body != null) {
|
||||
System.out.println("Response:" + body.string())
|
||||
}
|
||||
} else System.err.println("Error Occurred")
|
||||
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
// try {
|
||||
// Jsoup.connect("https://missav.com/").userAgent(USAGT).timeout(300000).get().apply {
|
||||
// BLog.LOGE("https://missav.com/dm507/en/release >>>> ${this}")
|
||||
// }
|
||||
// }catch (e : Exception) {
|
||||
// e.printStackTrace()
|
||||
//
|
||||
// }
|
||||
}, 2, TimeUnit.SECONDS)
|
||||
// lActivity?.doWebParseStart("https://missav.com/dm507/en/release") {}
|
||||
}
|
||||
"jmiss" -> {
|
||||
lActivity?.doWebParseStart("https://missav.com/dm11/ko") {}
|
||||
lActivity?.doWebParseStart("https://missav.com/dm16/en") {}
|
||||
}
|
||||
"jreq" -> {
|
||||
lActivity?.doWebParseStart(jGuruMain) {}
|
||||
|
||||
@ -84,6 +84,7 @@ import rasel.lunar.launcher.qaccess.QuickAccess
|
||||
import rasel.lunar.launcher.settings.SettingsActivity
|
||||
import rasel.lunar.launcher.todos.MissedCallsAdapter
|
||||
import rasel.lunar.launcher.model.RssDataInterface
|
||||
import rasel.lunar.launcher.model.RssDataType
|
||||
import rasel.lunar.launcher.todos.NotificationItemAdapter
|
||||
import rasel.lunar.launcher.todos.RssItemAdapter
|
||||
import rasel.lunar.launcher.todos.SmsLogsAdapter
|
||||
@ -118,7 +119,6 @@ internal class LauncherHome : Fragment() {
|
||||
var callList = arrayListOf<RecentCall>()
|
||||
var smsList = arrayListOf<RecentSms>()
|
||||
var listTags = arrayListOf<RssDataInterface>()
|
||||
var listItem = arrayListOf<RssDataInterface>()
|
||||
}
|
||||
|
||||
private var nReceiver: NotificationReceiver? = null
|
||||
@ -232,8 +232,9 @@ internal class LauncherHome : Fragment() {
|
||||
registerReceiver(requireContext(),nReceiver, filter,RECEIVER_EXPORTED)
|
||||
|
||||
BLog.LOGE("onCreateView()")
|
||||
mRssDataResult = WorkersDb.getRealm().query<RssData>().query("pubDate > $0",beforeDay(Date(),3)).sort("pubDate ", Sort.DESCENDING).find()
|
||||
mNotificationResult = WorkersDb.getRealm().query<NotificationItem>().find()
|
||||
|
||||
mRssDataResult = WorkersDb.getRealm().query<RssData>().query("pubDate > $0",beforeDay(Date(),3)).query("category != $0", RssDataType.GURU.name).sort("pubDate ", Sort.DESCENDING).find()
|
||||
mNotificationResult = WorkersDb.getRealm().query<NotificationItem>().sort("postTime",Sort.DESCENDING).find()
|
||||
job = CoroutineScope(Dispatchers.Default).launch {
|
||||
mRssDataResult.asFlow().collect { changes: ResultsChange<RssData> ->
|
||||
when (changes) {
|
||||
|
||||
6
app/src/main/res/xml/network_security_config.xml
Normal file
6
app/src/main/res/xml/network_security_config.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<network-security-config>
|
||||
<base-config cleartextTrafficPermitted="false">
|
||||
|
||||
</base-config>
|
||||
</network-security-config>
|
||||
Loading…
x
Reference in New Issue
Block a user