diff --git a/app/src/main/kotlin/rasel/lunar/launcher/LauncherActivity.kt b/app/src/main/kotlin/rasel/lunar/launcher/LauncherActivity.kt index a574b3a..080cc60 100644 --- a/app/src/main/kotlin/rasel/lunar/launcher/LauncherActivity.kt +++ b/app/src/main/kotlin/rasel/lunar/launcher/LauncherActivity.kt @@ -107,6 +107,7 @@ import rasel.lunar.launcher.workers.RedditGetter import rasel.lunar.launcher.workers.WorkersDb import rasel.lunar.launcher.workers.YoutubeGetter import java.text.SimpleDateFormat +import java.util.Calendar import java.util.Date import java.util.Locale import java.util.concurrent.Executors @@ -500,16 +501,21 @@ internal class LauncherActivity : AppCompatActivity() { } var callBack : (()->Unit)? = null + var isF = false fun doWebParseStart(url : String, callBack : (()->Unit)?) { + isF = true 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 { -//// view?.loadUrl(url!!) -// return false -// } + override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean { + if (!isF && url?.contains("missav") == true) { + view?.loadUrl(url!!) + isF = true + } + return false + } override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) { BLog.LOGE("binding.otherCheck searcher01 in onPageStarted ${url}") @@ -531,11 +537,13 @@ internal class LauncherActivity : AppCompatActivity() { } + override fun onPageFinished(view: WebView?, url: String?) { super.onPageFinished(view, url) lastedFinishedPageUrl = 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) { view?.evaluateJavascript( "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() - binding.searcher01.post { binding.searcher01.visibility = View.GONE } - } +// callBack?.invoke() +// binding.searcher01.post { binding.searcher01.visibility = View.GONE } +// } } } WebView.setWebContentsDebuggingEnabled(false) @@ -577,7 +591,7 @@ internal class LauncherActivity : AppCompatActivity() { setLayerType(View.LAYER_TYPE_SOFTWARE, null) // 랜더링 이슈 해결 try { 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 // 자바스크립트 사용 가능하도록 설정 loadWithOverviewMode = true // 전체 웹페이지를 화면에 맞게 로드 useWideViewPort = true // 화면에 맞게 페이지 확대/축소 @@ -726,7 +740,8 @@ internal class LauncherActivity : AppCompatActivity() { } }.apply { WorkersDb.insertBulkData(temp) - binding.searcher01?.post { binding.searcher01.loadData("",null,null) } +// BLog.LOGE("temp >>> ${temp.size}") +// binding.searcher01?.post { binding.searcher01.loadData("",null,null) } } } @@ -762,10 +777,17 @@ class MissD : RssDataInterface { } override fun pubDate(): Long { - return beforeDay(Date(),3) + 36000L + return beforeDay(Date()) } override fun category(): RssDataType { 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 } \ No newline at end of file diff --git a/app/src/main/kotlin/rasel/lunar/launcher/feeds/Feeds.kt b/app/src/main/kotlin/rasel/lunar/launcher/feeds/Feeds.kt index 418828d..1ead8fa 100644 --- a/app/src/main/kotlin/rasel/lunar/launcher/feeds/Feeds.kt +++ b/app/src/main/kotlin/rasel/lunar/launcher/feeds/Feeds.kt @@ -24,6 +24,7 @@ import android.appwidget.AppWidgetManager import android.content.DialogInterface import android.content.Intent import android.content.SharedPreferences +import android.net.Uri import android.os.* import android.view.* import android.widget.EditText @@ -38,6 +39,7 @@ import androidx.lifecycle.repeatOnLifecycle import com.google.android.material.button.MaterialButtonToggleGroup import io.realm.kotlin.ext.query import kotlinx.coroutines.* +import org.jsoup.Jsoup import rasel.lunar.launcher.LauncherActivity.Companion.appWidgetHost import rasel.lunar.launcher.LauncherActivity.Companion.appWidgetManager 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.RssDataInterface import rasel.lunar.launcher.model.RssDataType +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.* @@ -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 */ private fun startService() { binding.feedsRss.rss.visibility = View.GONE @@ -153,67 +165,98 @@ internal class Feeds : Fragment() { builder.setPositiveButton(android.R.string.ok, DialogInterface.OnClickListener { dialog, which -> dialog.dismiss() - when(input.text.toString()) { - "ytb" -> { - refreshYoutube() - } - "reddit"->{ - refreshReddit() - } - "fedd"->{ - refreshFeeds() - } - "comic"->{ - refreshComics() - } - "taxi"-> { - home?.showAl() - } - "tax"-> { - home?.hideAl() - } - "jshow" -> { - binding.feedsRss.apply { - rss.adapter = mRssAdapter - loading.visibility = View.VISIBLE - if (listItem.size > 0) { - listItem.sortByDescending { it.pubDate() } - WorkersDb.getRealm().query("category == '$0'", RssDataType.GURU.name).find()?.apply { - mRssAdapter?.updateData(listItem) + 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() + } - 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) + } + + } else { + when (input.text.toString()) { + + "ytb" -> { + refreshYoutube() + } + + "reddit" -> { + refreshReddit() + } + + "fedd" -> { + refreshFeeds() + } + + "comic" -> { + refreshComics() + } + + "taxi" -> { + home?.showAl() + } + + "tax" -> { + home?.hideAl() + } + + "jshow" -> { + binding.feedsRss.apply { + rss.adapter = mRssAdapter + loading.visibility = View.VISIBLE + if (listItem.size > 0) { + listItem.sortByDescending { it.pubDate() } + WorkersDb.getRealm() + .query("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) + } } } } } } - } - "jjp" -> { - lActivity?.doWebParseStart("https://projectjav.com") {} - } - "jmiss" -> { - lActivity?.doWebParseStart("https://missav.com/dm11/ko") {} - } - "jreq" -> { - lActivity?.doWebParseStart(jGuruMain) {} - } - "jtag"-> { + + "jjp" -> { + lActivity?.doWebParseStart("https://projectjav.com") {} + } + "jmnew" -> { + lActivity?.doWebParseStart("https://missav.com/dm511/ko/new") {} + } + "jmiss" -> { + lActivity?.doWebParseStart("https://missav.com/dm11/ko") {} + } + "jreq" -> { + lActivity?.doWebParseStart(jGuruMain) {} + } + + "jtag" -> { // lActivity?.doWebPare(TEST_PAG.plus("tags")) { binding.feedsRss.apply { @@ -231,21 +274,23 @@ internal class Feeds : Fragment() { refresh.setOnClickListener { lActivity?.doWebParseStart(jGuruMain.plus("tags")) { if (listTags.size > 0) { - rss2?.postDelayed( { + rss2?.postDelayed({ mRssAdapter2?.updateData(listTags) loading.visibility = View.GONE refresh.visibility = View.GONE rss2.visibility = View.VISIBLE - },500L) + }, 500L) } } } } } // } - } - else -> { - binding.expandRss.isChecked = false + } + + else -> { + binding.expandRss.isChecked = false + } } } diff --git a/app/src/main/kotlin/rasel/lunar/launcher/home/LauncherHome.kt b/app/src/main/kotlin/rasel/lunar/launcher/home/LauncherHome.kt index 6d4d606..2355191 100644 --- a/app/src/main/kotlin/rasel/lunar/launcher/home/LauncherHome.kt +++ b/app/src/main/kotlin/rasel/lunar/launcher/home/LauncherHome.kt @@ -152,7 +152,7 @@ internal class LauncherHome : Fragment() { if (lastedNoti?.size ?: 0 > 0) { binding.otherCheck.text = "최근 정보[${lasted!!.size}]" mRssAdapter.updateData(lasted!!) - binding.infoList.smoothScrollToPosition(0) +// binding.infoList.smoothScrollToPosition(0) } } @@ -464,7 +464,7 @@ internal class LauncherHome : Fragment() { if (lasted?.size ?: 0 > 0) { binding.otherCheck.text = "최근 정보[${lasted!!.size}]" mRssAdapter.updateData(lasted!!) - binding.infoList.smoothScrollToPosition(0) +// binding.infoList.smoothScrollToPosition(0) } } } @@ -477,7 +477,7 @@ internal class LauncherHome : Fragment() { if (lastedNoti?.size ?: 0 > 0) { binding.otherCheck.text = "알림 센터[${lastedNoti!!.size}]" mNotiAdapter.updateData(lastedNoti!!) - binding.notiList.smoothScrollToPosition(0) +// binding.notiList.smoothScrollToPosition(0) } } } diff --git a/app/src/main/kotlin/rasel/lunar/launcher/todos/RssItemAdapter.kt b/app/src/main/kotlin/rasel/lunar/launcher/todos/RssItemAdapter.kt index 1084f02..b953561 100644 --- a/app/src/main/kotlin/rasel/lunar/launcher/todos/RssItemAdapter.kt +++ b/app/src/main/kotlin/rasel/lunar/launcher/todos/RssItemAdapter.kt @@ -162,8 +162,8 @@ internal class RssItemAdapter ( // false // } - - holder.view.root.setOnLongClickListener { + holder.view.title.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)) { @@ -173,6 +173,24 @@ internal class RssItemAdapter ( }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 + } + 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 } @@ -181,6 +199,7 @@ internal class RssItemAdapter ( } 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)