diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 406af2b5..b66effb4 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -111,7 +111,9 @@ dependencies {
implementation("com.github.delight-im:Android-AdvancedWebView:v3.2.1")
implementation(project(":library"))
implementation(project(":utils"))
-// implementation ("org.apache.tika:tika-parsers:1.12")
+// implementation("org.mozilla.geckoview:geckoview:139.0.20250523173407")
+ // https://mvnrepository.com/artifact/org.mozilla.geckoview/geckoview
+ implementation("org.mozilla.geckoview:geckoview:139.0.20250523173407")
// implementation("org.opencv:opencv-android:4.11.0")
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f45aca64..0ed8988b 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -78,12 +78,12 @@
android:windowSoftInputMode="adjustResize"
android:requestLegacyExternalStorage="true"
>
-
+
@@ -93,9 +93,9 @@
-
-
+
+
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt b/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt
index da022af1..1270ccce 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt
@@ -76,7 +76,6 @@ import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.apps.AppDrawer
import bums.lunatic.launcher.common.CommonActivity
import bums.lunatic.launcher.databinding.LauncherActivityBinding
-import bums.lunatic.launcher.feeds.Feeds
import bums.lunatic.launcher.feeds.WidgetHost
import bums.lunatic.launcher.helpers.BluetoothManager
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_APPLICATION_THEME
@@ -1038,9 +1037,9 @@ internal class LauncherActivity : CommonActivity() {
// }
// }
- fun switchFeeds() {
- startActivity(Intent(this,Feeds::class.java))
- }
+// fun switchFeeds() {
+// startActivity(Intent(this,Feeds::class.java))
+// }
// inner class MyJavaScriptInterface(val webView: WebView) {
// @JavascriptInterface
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/feeds/Feeds.kt b/app/src/main/kotlin/bums/lunatic/launcher/feeds/Feeds.kt
index 4ce4f4f4..aad52d91 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/feeds/Feeds.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/feeds/Feeds.kt
@@ -1,776 +1,776 @@
-/*
- * 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 .
- */
-
-package bums.lunatic.launcher.feeds
-
-import android.Manifest
-import android.content.DialogInterface
-import android.content.Intent
-import android.content.SharedPreferences
-import android.content.pm.PackageManager
-import android.net.Uri
-import android.os.Bundle
-import android.os.Handler
-import android.os.Looper
-import android.speech.RecognitionListener
-import android.speech.RecognizerIntent
-import android.speech.SpeechRecognizer
-import android.text.method.ScrollingMovementMethod
-import android.view.ContextMenu
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.EditText
-import androidx.appcompat.app.AlertDialog
-import androidx.core.view.isVisible
-import bums.lunatic.launcher.CommadCallabck
-import bums.lunatic.launcher.LauncherActivity.Companion.getCal
-import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
-import bums.lunatic.launcher.LauncherActivity.Companion.refreshDeviceData
-import bums.lunatic.launcher.LauncherActivity.Companion.refreshFeeds
-import bums.lunatic.launcher.R
-import bums.lunatic.launcher.common.CommonActivity
-import bums.lunatic.launcher.databinding.FeedsBinding
-import bums.lunatic.launcher.feeds.rss.RssAdapter
-import bums.lunatic.launcher.helpers.Constants.Companion.KEY_WIDGET_HEIGHTS
-import bums.lunatic.launcher.helpers.Constants.Companion.KEY_WIDGET_IDS
-import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_WIDGETS
-import bums.lunatic.launcher.helpers.Constants.Companion.SEPARATOR
-import bums.lunatic.launcher.helpers.PrefBoolean
-import bums.lunatic.launcher.helpers.PrefString
-import bums.lunatic.launcher.home.LauncherHome.Companion.home
-import bums.lunatic.launcher.model.CiliMagnet
-import bums.lunatic.launcher.model.RssData
-import bums.lunatic.launcher.model.RssDataInterface
-import bums.lunatic.launcher.model.RssDataType
-import bums.lunatic.launcher.model.jGuruTag
-import bums.lunatic.launcher.utils.Blog
-import bums.lunatic.launcher.utils.FeedParseManager
-import bums.lunatic.launcher.utils.getJ
-import bums.lunatic.launcher.workers.RecentCallGetter
-import bums.lunatic.launcher.workers.RecentSmsGetter
-import bums.lunatic.launcher.workers.WorkersDb
-import com.google.android.material.button.MaterialButtonToggleGroup
-import com.google.gson.Gson
-import io.realm.kotlin.ext.query
-import io.realm.kotlin.query.Sort
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.launch
-import org.jsoup.Jsoup
-import java.net.URLEncoder
-import java.nio.charset.Charset
-import java.util.Base64
-
-
-internal class Feeds : CommonActivity() , CommadCallabck {
-
- private lateinit var binding: FeedsBinding
- private val requestCodeString = "requestCode"
- var mRssAdapter : RssAdapter? = null
- var mRssAdapter2 : RssAdapter? = null
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- binding = FeedsBinding.inflate(layoutInflater)
- setContentView(binding.root)
- mRssAdapter = RssAdapter(this)
- mRssAdapter2 = RssAdapter(this)
- binding.feedsRss.rss.adapter = mRssAdapter
- binding.feedsRss.rss2.adapter = mRssAdapter2
- binding.consoleLog.movementMethod = ScrollingMovementMethod();
-// updateWidgets()
- expandCollapse()
- systemInfo()
- }
-
- override fun onResume() {
- super.onResume()
- registerForContextMenu(binding.widgetContainer)
- }
-
- override fun onPause() {
- super.onPause()
- unregisterForContextMenu(binding.widgetContainer)
- if (binding.expandRss.isChecked)
- binding.expandRss.isChecked = false
- }
-
- override fun onCreateContextMenu(menu: ContextMenu, v: View, menuInfo: ContextMenu.ContextMenuInfo?) {
- super.onCreateContextMenu(menu, v, menuInfo)
- menu.clearHeader()
- menuInflater.inflate(R.menu.add_widget, menu)
- }
-
-// override fun onContextItemSelected(item: MenuItem): Boolean {
-// if (item.itemId == R.id.add_widget) selectWidget()
-// return super.onContextItemSelected(item)
+///*
+// * 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 .
+// */
+//
+//package bums.lunatic.launcher.feeds
+//
+//import android.Manifest
+//import android.content.DialogInterface
+//import android.content.Intent
+//import android.content.SharedPreferences
+//import android.content.pm.PackageManager
+//import android.net.Uri
+//import android.os.Bundle
+//import android.os.Handler
+//import android.os.Looper
+//import android.speech.RecognitionListener
+//import android.speech.RecognizerIntent
+//import android.speech.SpeechRecognizer
+//import android.text.method.ScrollingMovementMethod
+//import android.view.ContextMenu
+//import android.view.LayoutInflater
+//import android.view.View
+//import android.view.ViewGroup
+//import android.widget.EditText
+//import androidx.appcompat.app.AlertDialog
+//import androidx.core.view.isVisible
+//import bums.lunatic.launcher.CommadCallabck
+//import bums.lunatic.launcher.LauncherActivity.Companion.getCal
+//import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
+//import bums.lunatic.launcher.LauncherActivity.Companion.refreshDeviceData
+//import bums.lunatic.launcher.LauncherActivity.Companion.refreshFeeds
+//import bums.lunatic.launcher.R
+//import bums.lunatic.launcher.common.CommonActivity
+//import bums.lunatic.launcher.databinding.FeedsBinding
+//import bums.lunatic.launcher.feeds.rss.RssAdapter
+//import bums.lunatic.launcher.helpers.Constants.Companion.KEY_WIDGET_HEIGHTS
+//import bums.lunatic.launcher.helpers.Constants.Companion.KEY_WIDGET_IDS
+//import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_WIDGETS
+//import bums.lunatic.launcher.helpers.Constants.Companion.SEPARATOR
+//import bums.lunatic.launcher.helpers.PrefBoolean
+//import bums.lunatic.launcher.helpers.PrefString
+//import bums.lunatic.launcher.home.LauncherHome.Companion.home
+//import bums.lunatic.launcher.model.CiliMagnet
+//import bums.lunatic.launcher.model.RssData
+//import bums.lunatic.launcher.model.RssDataInterface
+//import bums.lunatic.launcher.model.RssDataType
+//import bums.lunatic.launcher.model.jGuruTag
+//import bums.lunatic.launcher.utils.Blog
+//import bums.lunatic.launcher.utils.FeedParseManager
+//import bums.lunatic.launcher.utils.getJ
+//import bums.lunatic.launcher.workers.RecentCallGetter
+//import bums.lunatic.launcher.workers.RecentSmsGetter
+//import bums.lunatic.launcher.workers.WorkersDb
+//import com.google.android.material.button.MaterialButtonToggleGroup
+//import com.google.gson.Gson
+//import io.realm.kotlin.ext.query
+//import io.realm.kotlin.query.Sort
+//import kotlinx.coroutines.CoroutineScope
+//import kotlinx.coroutines.Dispatchers
+//import kotlinx.coroutines.launch
+//import org.jsoup.Jsoup
+//import java.net.URLEncoder
+//import java.nio.charset.Charset
+//import java.util.Base64
+//
+//
+//internal class Feeds : CommonActivity() , CommadCallabck {
+//
+// private lateinit var binding: FeedsBinding
+// private val requestCodeString = "requestCode"
+// var mRssAdapter : RssAdapter? = null
+// var mRssAdapter2 : RssAdapter? = null
+//
+// override fun onCreate(savedInstanceState: Bundle?) {
+// super.onCreate(savedInstanceState)
+// binding = FeedsBinding.inflate(layoutInflater)
+// setContentView(binding.root)
+// mRssAdapter = RssAdapter(this)
+// mRssAdapter2 = RssAdapter(this)
+// binding.feedsRss.rss.adapter = mRssAdapter
+// binding.feedsRss.rss2.adapter = mRssAdapter2
+// binding.consoleLog.movementMethod = ScrollingMovementMethod();
+//// updateWidgets()
+// expandCollapse()
+// systemInfo()
// }
-
- /* control view's expand-collapse actions */
- private fun expandCollapse() {
- binding.expandableButtons.addOnButtonCheckedListener { _: MaterialButtonToggleGroup?, checkedId: Int, isChecked: Boolean ->
- if (isChecked) {
- when (checkedId) {
- binding.expandRss.id -> {
- binding.feedsRss.rss.visibility = View.GONE
- binding.feedsRss.rss2.visibility = View.GONE
- binding.feedsSysInfos.expandableSystemInfo.collapse()
- binding.feedsRss.expandableRss.expand()
- startService()
- }
- binding.expandSystemInfo.id -> {
- binding.feedsRss.expandableRss.collapse()
- binding.feedsSysInfos.expandableSystemInfo.expand()
- }
- }
- } else {
- when (checkedId) {
- binding.expandRss.id -> binding.feedsRss.expandableRss.collapse()
- binding.expandSystemInfo.id -> binding.feedsSysInfos.expandableSystemInfo.collapse()
- }
- }
- }
- }
-
- fun consoleLog(str : String) {
- mMainHandler.removeCallbacks(hideConsole)
- binding.consoleLog.post {
- binding.consoleLog.visibility = View.VISIBLE
- binding.consoleLog.text = binding.consoleLog.text.toString() + "\n" + str
- }
- mMainHandler.postDelayed(hideConsole,10000L)
- Blog.LOGE("consoleLog >>>> ${str}")
- }
-
- 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")
- startActivity(mapIntent)
- }
-
- override fun onConsoleLog(log: String) {
- consoleLog(log)
- }
-
-
- val mMainHandler = Handler(Looper.getMainLooper())
- val hideConsole = {
- binding.consoleLog.visibility = View.GONE
- binding.consoleLog.text = ""
- }
- override fun collectComplete() {
-
- }
- var speechRecognizer : SpeechRecognizer? = null
-
- /* start rss service if network is active and rss url is not empty */
- private fun startService() {
- try {
- System.gc()
- }catch (e : Exception){e.printStackTrace()}
- binding.feedsRss.rss.visibility = View.GONE
- binding.feedsRss.rss2.visibility = View.GONE
- binding.feedsRss.loading.visibility = View.VISIBLE
- binding.feedsRss.refresh.visibility = View.VISIBLE
- val builder: AlertDialog.Builder = AlertDialog.Builder(this)
- builder.setTitle("Command Line")
- val viewInflated: View = LayoutInflater.from(this)
- .inflate(R.layout.text_inpu_password, binding.root as ViewGroup?, false)
- val input = viewInflated.findViewById(R.id.input) as EditText
- builder.setView(viewInflated)
- builder.setPositiveButton(android.R.string.ok,
- DialogInterface.OnClickListener { dialog, which ->
- dialog.dismiss()
- consoleLog("input.text.toString() >>>> ${input.text.toString()}")
- if (input.text.toString().trim().contains(" ")) {
- val cmd = input.text.toString().trim().split(" ")
- when(cmd[0]) {
- "code"-> {
- if (cmd[1].trim().length > 1) {
- CoroutineScope(Dispatchers.IO).launch {
- consoleLog("${cmd[0]} Start ${cmd[1]}")
- String.format("https://glojav.us/search?q=",cmd[1]).getJ().let { doc -> FeedParseManager.parse(doc){consoleLog(it)} }
- consoleLog("${cmd[0]} END ${cmd[1]}")
- }
- }
- }
- "car" -> {
- if (cmd[1].trim().length > 2) {
- PrefString.carName.set(cmd[1].trim())
- }
- consoleLog(PrefString.carName.get())
- }
- "tt" -> {
- if (cmd[1].trim().length > 5) {
- PrefString.telegramSendTarget.set(cmd[1].trim())
- }
- consoleLog(PrefString.telegramSendTarget.get())
- }
- "so"-> {
- CoroutineScope(Dispatchers.IO).launch {
- consoleLog("${cmd[0]} Start ${cmd[1]}")
- String.format(String(Base64.getMimeDecoder().decode("aHR0cHM6Ly9rciVzLnNvZ2lybC5zby8=".toByteArray())),cmd[1]).getJ().let { doc -> FeedParseManager.parse(doc){consoleLog(it)} }
- consoleLog("current j req() ${WorkersDb.getRealm().query("category == $0", RssDataType.GURU.name).find().size}")
- consoleLog("${cmd[0]} END ${cmd[1]}")
- }
- }
- "s" -> {
- home?.queryInfos(keyword = cmd[1])
- }
- "jf" -> {
- CoroutineScope(Dispatchers.IO).launch {
- consoleLog("${cmd[0]} Start ${cmd[1]}")
- String(Base64.getMimeDecoder().decode("aHR0cHM6Ly9qYXZtb3N0LnRvL2xhdGVzdC11cGRhdGVzCg==".toByteArray())).getJ().let { doc -> FeedParseManager.parse(doc){consoleLog(it)} }
- consoleLog("current j req() ${WorkersDb.getRealm().query("category == $0", RssDataType.GURU.name).find().size}")
- consoleLog("${cmd[0]} END ${cmd[1]}")
- }
- CoroutineScope(Dispatchers.IO).launch {
- consoleLog("${cmd[0]} Start ${cmd[1]}")
- String.format(String(Base64.getMimeDecoder().decode("aHR0cHM6Ly9qYXZtb3N0LnRvL3NlYXJjaC9tb3ZpZS8lcw==".toByteArray())),cmd[1]).getJ().let { doc -> FeedParseManager.parse(doc){consoleLog(it)} }
- consoleLog("current j req() ${WorkersDb.getRealm().query("category == $0", RssDataType.GURU.name).find().size}")
- consoleLog("${cmd[0]} END ${cmd[1]}")
- }
- CoroutineScope(Dispatchers.IO).launch {
- consoleLog("on Cmd JF with MOST")
- consoleLog("${cmd[0]} Start ${cmd[1]}")
- String.format(String(Base64.getMimeDecoder().decode("aHR0cHM6Ly9rcjcxLnNvZ2lybC5zby8/cz0lcw==".toByteArray())),cmd[1]).getJ().let { doc -> FeedParseManager.parse(doc){consoleLog(it)} }
- consoleLog("current j req() ${WorkersDb.getRealm().query("category == $0", RssDataType.MOST.name).find().size}")
- consoleLog("${cmd[0]} END ${cmd[1]}")
- }
- }
- "mgn"-> {
- CoroutineScope(Dispatchers.IO).launch {
- var temp = arrayListOf()
- consoleLog("this >>>> cili ${cmd[0]} -> ${cmd[1]}")
- Jsoup.connect("https://cili.site/search?q=${URLEncoder.encode(cmd[1], Charset.defaultCharset().name())}").get().let { cili ->
- consoleLog("this >>>> cili ${cili.title()}")
- cili.getElementsByTag("tr").forEach { cili_tr ->
- CiliMagnet().let { ciliMgn ->
- ciliMgn.link = if(cili_tr.getElementsByTag("a").size > 0)cili_tr.getElementsByTag("a").get(0).attr("href") else ""
- ciliMgn.title = if(cili_tr.getElementsByTag("p").size > 0)cili_tr.getElementsByTag("p").text() else ""
- ciliMgn.size = if(cili_tr.getElementsByClass("td-size").size > 0)cili_tr.getElementsByClass("td-size").text() else ""
- if(ciliMgn.isValid() && temp.size < 8 ) {
- Jsoup.connect(ciliMgn.getMagnetPageLink()).get().let { mgn_Page ->
- consoleLog("magnet_page >>> ${mgn_Page.title()}")
- if (mgn_Page.getElementsByClass("input-group magnet-box").size > 0) {
- mgn_Page.getElementsByClass("input-group magnet-box")
- .get(0)?.let { magnet_box ->
- magnet_box.getElementById(
- "input-magnet"
- )?.let { input_magnet ->
-// BLog.LOGE("input_magnet >>> ${input_magnet}")
- ciliMgn.magnetLink = input_magnet.attr("value").replace("&","&")
- }
- }
- }
- }.apply {
- temp.add(ciliMgn)
- }
- }
- }
-
- }.apply {
- temp.forEach {
- consoleLog("ciliResult >>> ${Gson().toJson(it)}")
- }
- }
- }
- }.start()
- }
- }
- binding.expandRss.isChecked = false
- } else {
- when (input.text.toString()) {
- "spe"->{
- speechRecognizer?.stopListening()
- speechRecognizer?.destroy()
- speechRecognizer = null
- }
- "sps"->{
- let { lActivity ->
- if (lActivity.checkSelfPermission(Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
- lActivity.requestPermissions(arrayOf(Manifest.permission.RECORD_AUDIO), 1)
- } else {
- speechRecognizer = SpeechRecognizer.createSpeechRecognizer(lActivity)
- val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)
- intent.putExtra(
- RecognizerIntent.EXTRA_LANGUAGE_MODEL,
- RecognizerIntent.LANGUAGE_MODEL_FREE_FORM
- )
- intent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true)
-
- speechRecognizer?.setRecognitionListener(object : RecognitionListener {
- override fun onReadyForSpeech(params: Bundle) {
- consoleLog("onReadyForSpeech ")
- }
-
- override fun onBeginningOfSpeech() {
- consoleLog("onBeginningOfSpeech ")
- }
-
- override fun onRmsChanged(rmsdB: Float) {}
-
- override fun onBufferReceived(buffer: ByteArray) {}
-
- override fun onEndOfSpeech() {
- consoleLog("onEndOfSpeech ")
- }
-
- override fun onError(error: Int) {
- consoleLog("onError ${error}")
- }
-
- override fun onResults(results: Bundle) {
- val matches =
- results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)
- if (matches != null) {
- val recognizedText = matches[0]
- consoleLog("recognizedText ${recognizedText}")
- }
- }
-
- override fun onPartialResults(partialResults: Bundle) {
- consoleLog("recognizedText ${partialResults}")
- }
-
- override fun onEvent(eventType: Int, params: Bundle) {}
- })
-
- speechRecognizer?.startListening(intent)
- }
- }
- }
- "citys" -> {
- val baseUrl = "https://www.worldcitydb.com/"
- var nations = arrayListOf()
- CoroutineScope(Dispatchers.IO).launch {
- "https://www.worldcitydb.com/search-by-country?lang=ko".getJ().let { doc ->
- Blog.LOGE("it.title() >> ${doc.title()}")
- doc.getElementsByTag("tr").forEach { table ->
- table.children().forEach {
- it.getElementsByTag("td").forEach { td ->
- td.children().forEach {
- if (it.tag().name.equals("a")) {
- Blog.LOGE("TD>>A ${it}")
- it.text()
- }
- }
- }
- }
- }
- }
- }
- }
- "loc_ck" -> {
- FeedsResult().show(supportFragmentManager, "")
- }
- "loc_on" -> {
- PrefBoolean.location.set(!PrefBoolean.location.get())
- consoleLog("PrefHelper.isLocationOn() >>> ${PrefBoolean.location.get()}")
- updateLocationService()
- }
- "cal" ->{
- getCal()
- }
- "ojs" -> home?.queryInfos(arrayListOf().apply {
- addAll(RssDataType.values())
- remove(RssDataType.GURU)
- remove(RssDataType.MOST)
- })
- "all" -> home?.queryInfos(arrayListOf().apply {
-
- })
- "onews" -> home?.queryInfos(arrayListOf().apply {
- addAll(RssDataType.values())
- remove(RssDataType.NEWSFEED)
- })
- "ored" -> home?.queryInfos(arrayListOf().apply {
- addAll(RssDataType.values())
- remove(RssDataType.REDDIT)
- })
- "req" -> {
- refreshFeeds()
- refreshDeviceData()
- consoleLog("excute refreshFeeds()")
- }
- "reqmax" -> {
- refreshFeeds()
- RecentCallGetter.dayRange = 365
- RecentSmsGetter.dayRange = 365
- refreshDeviceData()
- consoleLog("excute refreshFeeds()")
- }
-
- "taxi" -> {
- consoleLog("before run State home?.binding?.alcholKatalkT?.isVisible >> ${home?.binding?.alcholKatalkT?.isVisible}")
- home?.showAl()
- consoleLog("after run State home?.binding?.alcholKatalkT?.isVisible >> ${home?.binding?.alcholKatalkT?.isVisible}")
- }
-
- "tax" -> {
- consoleLog("before run State home?.binding?.alcholKatalkT?.isVisible >> ${home?.binding?.alcholKatalkT?.isVisible}")
- home?.hideAl()
- consoleLog("after run State home?.binding?.alcholKatalkT?.isVisible >> ${home?.binding?.alcholKatalkT?.isVisible}")
- }
-
- "jshow" -> {
- binding.feedsRss.apply {
- rss.adapter = mRssAdapter
- loading.visibility = View.VISIBLE
- mRssAdapter?.updateData(WorkersDb.getRealm()
- .query("category == $0 || category == $1", RssDataType.GURU.name, RssDataType.MOST.name)
- .sort("pubDate", Sort.DESCENDING).find())
- rss.visibility = View.VISIBLE
- loading.visibility = View.GONE
- refresh.visibility = View.GONE
- }
- }
- "jjp" -> {
-// doWebParseStart("https://projectjav.com") {}
- }
- "jmnew" -> {
-// doWebParseStart("https://missav.com/dm507/en/release") {}
- }
- "jmiss" -> {
-// doWebParseStart("https://missav.com/dm16/en") {}
- }
-// "jreq" -> {
-// consoleLog("current j req() ${WorkersDb.getRealm()
-// .query("category == $0", RssDataType.GURU.name).find().size}")
-// CoroutineScope(Dispatchers.IO).launch {
-// var isOk = false
-//// plist.forEach {
-// if (!isOk) {
-// try {
-// Jsoup.connect(jGuruMain)
-// .userAgent("Mozilla/5.0 (Linux; Android 13) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.5414.117 Mobile Safari/537.36")
-// .referrer("http://www.google.com")
-// .header("Accept-Language", "it-IT,en;q=0.8,en-US;q=0.6,de;q=0.4,it;q=0.2,es;q=0.2")
-// .header("Connection", "keep-alive")
-// .header("scheme", "https")
-// .header("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8")
-// .header("accept-encoding", "gzip, deflate, br")
-// .header("cache-control", "no-cache")
-// .header("pragma", "no-cache")
-// .header("upgrade-insecure-requests", "1")
-// .ignoreContentType(true)
-// .timeout(30000).execute().let {
-// BLog.LOGE("DOC -> ${it}")
-// isOk = true
-// }
-// } catch (e: Exception) {
-// e.printStackTrace()
-// }
-// }
-//// }
-// BLog.LOGE("last state ${isOk}")
-// }
-//// doWebParseStart(jGuruMain,callBack = object : CommadCallabck {
-//// override fun onConsoleLog(log: String) {
-//// this@Feeds.consoleLog(log)
-//// }
-////
-//// override fun collectComplete() {
-//// consoleLog("excuted j req() ${WorkersDb.getRealm()
-//// .query("category == $0", RssDataType.GURU.name).find().size}")
-//// }
-//// })
-// }
//
-// "jtag" -> {
-//// doWebPare(TEST_PAG.plus("tags")) {
-// binding.feedsRss.apply {
-// rss2.adapter = mRssAdapter2
+// override fun onResume() {
+// super.onResume()
+// registerForContextMenu(binding.widgetContainer)
+// }
//
-// loading.visibility = View.VISIBLE
-// if (listTags.size > 0) {
-// mRssAdapter2?.updateData(listTags)
-// rss2.visibility = View.VISIBLE
-// loading.visibility = View.GONE
-// refresh.visibility = View.GONE
-// } else {
-// refresh.visibility = View.VISIBLE
-// rss2.visibility = View.GONE
-// refresh.setOnClickListener {
-// doWebParseStart(jGuruMain.plus("tags"), callBack = object : CommadCallabck {
-// override fun onConsoleLog(log: String) {
-// this@Feeds.consoleLog(log)
-// }
+// override fun onPause() {
+// super.onPause()
+// unregisterForContextMenu(binding.widgetContainer)
+// if (binding.expandRss.isChecked)
+// binding.expandRss.isChecked = false
+// }
//
-// override fun collectComplete() {
-// if (listTags.size > 0) {
-// rss2?.postDelayed({
-// mRssAdapter2?.updateData(listTags)
-// loading.visibility = View.GONE
-// refresh.visibility = View.GONE
-// rss2.visibility = View.VISIBLE
-// }, 500L)
-// }
-// }
-// })
-// }
-// }
-// }
-//// }
-// }
-
- else -> {
- binding.expandRss.isChecked = false
- }
- }
- }
-
- })
- builder.setNegativeButton(android.R.string.cancel,
- DialogInterface.OnClickListener { dialog, which -> dialog.cancel() })
-
- builder.show()
-// binding.feedsRss.apply {
-// if(rss.adapter != null) {
-// (rss.adapter as RssAdapter).items.clear()
+// override fun onCreateContextMenu(menu: ContextMenu, v: View, menuInfo: ContextMenu.ContextMenuInfo?) {
+// super.onCreateContextMenu(menu, v, menuInfo)
+// menu.clearHeader()
+// menuInflater.inflate(R.menu.add_widget, menu)
+// }
+//
+//// override fun onContextItemSelected(item: MenuItem): Boolean {
+//// if (item.itemId == R.id.add_widget) selectWidget()
+//// return super.onContextItemSelected(item)
+//// }
+//
+// /* control view's expand-collapse actions */
+// private fun expandCollapse() {
+// binding.expandableButtons.addOnButtonCheckedListener { _: MaterialButtonToggleGroup?, checkedId: Int, isChecked: Boolean ->
+// if (isChecked) {
+// when (checkedId) {
+// binding.expandRss.id -> {
+// binding.feedsRss.rss.visibility = View.GONE
+// binding.feedsRss.rss2.visibility = View.GONE
+// binding.feedsSysInfos.expandableSystemInfo.collapse()
+// binding.feedsRss.expandableRss.expand()
+// startService()
+// }
+// binding.expandSystemInfo.id -> {
+// binding.feedsRss.expandableRss.collapse()
+// binding.feedsSysInfos.expandableSystemInfo.expand()
+// }
+// }
+// } else {
+// when (checkedId) {
+// binding.expandRss.id -> binding.feedsRss.expandableRss.collapse()
+// binding.expandSystemInfo.id -> binding.feedsSysInfos.expandableSystemInfo.collapse()
+// }
// }
// }
-// val rssUrl = lActivity!!.getSharedPreferences(PREFS_SETTINGS, 0)
-// .getString(KEY_RSS_URL, "")
-// when {
-// isNetworkAvailable && !rssUrl.isNullOrEmpty() -> {
+// }
+//
+// fun consoleLog(str : String) {
+// mMainHandler.removeCallbacks(hideConsole)
+// binding.consoleLog.post {
+// binding.consoleLog.visibility = View.VISIBLE
+// binding.consoleLog.text = binding.consoleLog.text.toString() + "\n" + str
+// }
+// mMainHandler.postDelayed(hideConsole,10000L)
+// Blog.LOGE("consoleLog >>>> ${str}")
+// }
+//
+// 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")
+// startActivity(mapIntent)
+// }
+//
+// override fun onConsoleLog(log: String) {
+// consoleLog(log)
+// }
+//
+//
+// val mMainHandler = Handler(Looper.getMainLooper())
+// val hideConsole = {
+// binding.consoleLog.visibility = View.GONE
+// binding.consoleLog.text = ""
+// }
+// override fun collectComplete() {
+//
+// }
+// var speechRecognizer : SpeechRecognizer? = null
+//
+// /* start rss service if network is active and rss url is not empty */
+// private fun startService() {
+// try {
+// System.gc()
+// }catch (e : Exception){e.printStackTrace()}
+// binding.feedsRss.rss.visibility = View.GONE
+// binding.feedsRss.rss2.visibility = View.GONE
+// binding.feedsRss.loading.visibility = View.VISIBLE
+// binding.feedsRss.refresh.visibility = View.VISIBLE
+// val builder: AlertDialog.Builder = AlertDialog.Builder(this)
+// builder.setTitle("Command Line")
+// val viewInflated: View = LayoutInflater.from(this)
+// .inflate(R.layout.text_inpu_password, binding.root as ViewGroup?, false)
+// val input = viewInflated.findViewById(R.id.input) as EditText
+// builder.setView(viewInflated)
+// builder.setPositiveButton(android.R.string.ok,
+// DialogInterface.OnClickListener { dialog, which ->
+// dialog.dismiss()
+// consoleLog("input.text.toString() >>>> ${input.text.toString()}")
+// if (input.text.toString().trim().contains(" ")) {
+// val cmd = input.text.toString().trim().split(" ")
+// when(cmd[0]) {
+// "code"-> {
+// if (cmd[1].trim().length > 1) {
+// CoroutineScope(Dispatchers.IO).launch {
+// consoleLog("${cmd[0]} Start ${cmd[1]}")
+// String.format("https://glojav.us/search?q=",cmd[1]).getJ().let { doc -> FeedParseManager.parse(doc){consoleLog(it)} }
+// consoleLog("${cmd[0]} END ${cmd[1]}")
+// }
+// }
+// }
+// "car" -> {
+// if (cmd[1].trim().length > 2) {
+// PrefString.carName.set(cmd[1].trim())
+// }
+// consoleLog(PrefString.carName.get())
+// }
+// "tt" -> {
+// if (cmd[1].trim().length > 5) {
+// PrefString.telegramSendTarget.set(cmd[1].trim())
+// }
+// consoleLog(PrefString.telegramSendTarget.get())
+// }
+// "so"-> {
+// CoroutineScope(Dispatchers.IO).launch {
+// consoleLog("${cmd[0]} Start ${cmd[1]}")
+// String.format(String(Base64.getMimeDecoder().decode("aHR0cHM6Ly9rciVzLnNvZ2lybC5zby8=".toByteArray())),cmd[1]).getJ().let { doc -> FeedParseManager.parse(doc){consoleLog(it)} }
+// consoleLog("current j req() ${WorkersDb.getRealm().query("category == $0", RssDataType.GURU.name).find().size}")
+// consoleLog("${cmd[0]} END ${cmd[1]}")
+// }
+// }
+// "s" -> {
+// home?.queryInfos(keyword = cmd[1])
+// }
+// "jf" -> {
+// CoroutineScope(Dispatchers.IO).launch {
+// consoleLog("${cmd[0]} Start ${cmd[1]}")
+// String(Base64.getMimeDecoder().decode("aHR0cHM6Ly9qYXZtb3N0LnRvL2xhdGVzdC11cGRhdGVzCg==".toByteArray())).getJ().let { doc -> FeedParseManager.parse(doc){consoleLog(it)} }
+// consoleLog("current j req() ${WorkersDb.getRealm().query("category == $0", RssDataType.GURU.name).find().size}")
+// consoleLog("${cmd[0]} END ${cmd[1]}")
+// }
+// CoroutineScope(Dispatchers.IO).launch {
+// consoleLog("${cmd[0]} Start ${cmd[1]}")
+// String.format(String(Base64.getMimeDecoder().decode("aHR0cHM6Ly9qYXZtb3N0LnRvL3NlYXJjaC9tb3ZpZS8lcw==".toByteArray())),cmd[1]).getJ().let { doc -> FeedParseManager.parse(doc){consoleLog(it)} }
+// consoleLog("current j req() ${WorkersDb.getRealm().query("category == $0", RssDataType.GURU.name).find().size}")
+// consoleLog("${cmd[0]} END ${cmd[1]}")
+// }
+// CoroutineScope(Dispatchers.IO).launch {
+// consoleLog("on Cmd JF with MOST")
+// consoleLog("${cmd[0]} Start ${cmd[1]}")
+// String.format(String(Base64.getMimeDecoder().decode("aHR0cHM6Ly9rcjcxLnNvZ2lybC5zby8/cz0lcw==".toByteArray())),cmd[1]).getJ().let { doc -> FeedParseManager.parse(doc){consoleLog(it)} }
+// consoleLog("current j req() ${WorkersDb.getRealm().query("category == $0", RssDataType.MOST.name).find().size}")
+// consoleLog("${cmd[0]} END ${cmd[1]}")
+// }
+// }
+// "mgn"-> {
+// CoroutineScope(Dispatchers.IO).launch {
+// var temp = arrayListOf()
+// consoleLog("this >>>> cili ${cmd[0]} -> ${cmd[1]}")
+// Jsoup.connect("https://cili.site/search?q=${URLEncoder.encode(cmd[1], Charset.defaultCharset().name())}").get().let { cili ->
+// consoleLog("this >>>> cili ${cili.title()}")
+// cili.getElementsByTag("tr").forEach { cili_tr ->
+// CiliMagnet().let { ciliMgn ->
+// ciliMgn.link = if(cili_tr.getElementsByTag("a").size > 0)cili_tr.getElementsByTag("a").get(0).attr("href") else ""
+// ciliMgn.title = if(cili_tr.getElementsByTag("p").size > 0)cili_tr.getElementsByTag("p").text() else ""
+// ciliMgn.size = if(cili_tr.getElementsByClass("td-size").size > 0)cili_tr.getElementsByClass("td-size").text() else ""
+// if(ciliMgn.isValid() && temp.size < 8 ) {
+// Jsoup.connect(ciliMgn.getMagnetPageLink()).get().let { mgn_Page ->
+// consoleLog("magnet_page >>> ${mgn_Page.title()}")
+// if (mgn_Page.getElementsByClass("input-group magnet-box").size > 0) {
+// mgn_Page.getElementsByClass("input-group magnet-box")
+// .get(0)?.let { magnet_box ->
+// magnet_box.getElementById(
+// "input-magnet"
+// )?.let { input_magnet ->
+//// BLog.LOGE("input_magnet >>> ${input_magnet}")
+// ciliMgn.magnetLink = input_magnet.attr("value").replace("&","&")
+// }
+// }
+// }
+// }.apply {
+// temp.add(ciliMgn)
+// }
+// }
+// }
+//
+// }.apply {
+// temp.forEach {
+// consoleLog("ciliResult >>> ${Gson().toJson(it)}")
+// }
+// }
+// }
+// }.start()
+// }
+// }
+// binding.expandRss.isChecked = false
+// } else {
+// when (input.text.toString()) {
+// "spe"->{
+// speechRecognizer?.stopListening()
+// speechRecognizer?.destroy()
+// speechRecognizer = null
+// }
+// "sps"->{
+// let { lActivity ->
+// if (lActivity.checkSelfPermission(Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
+// lActivity.requestPermissions(arrayOf(Manifest.permission.RECORD_AUDIO), 1)
+// } else {
+// speechRecognizer = SpeechRecognizer.createSpeechRecognizer(lActivity)
+// val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)
+// intent.putExtra(
+// RecognizerIntent.EXTRA_LANGUAGE_MODEL,
+// RecognizerIntent.LANGUAGE_MODEL_FREE_FORM
+// )
+// intent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true)
+//
+// speechRecognizer?.setRecognitionListener(object : RecognitionListener {
+// override fun onReadyForSpeech(params: Bundle) {
+// consoleLog("onReadyForSpeech ")
+// }
+//
+// override fun onBeginningOfSpeech() {
+// consoleLog("onBeginningOfSpeech ")
+// }
+//
+// override fun onRmsChanged(rmsdB: Float) {}
+//
+// override fun onBufferReceived(buffer: ByteArray) {}
+//
+// override fun onEndOfSpeech() {
+// consoleLog("onEndOfSpeech ")
+// }
+//
+// override fun onError(error: Int) {
+// consoleLog("onError ${error}")
+// }
+//
+// override fun onResults(results: Bundle) {
+// val matches =
+// results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)
+// if (matches != null) {
+// val recognizedText = matches[0]
+// consoleLog("recognizedText ${recognizedText}")
+// }
+// }
+//
+// override fun onPartialResults(partialResults: Bundle) {
+// consoleLog("recognizedText ${partialResults}")
+// }
+//
+// override fun onEvent(eventType: Int, params: Bundle) {}
+// })
+//
+// speechRecognizer?.startListening(intent)
+// }
+// }
+// }
+// "citys" -> {
+// val baseUrl = "https://www.worldcitydb.com/"
+// var nations = arrayListOf()
+// CoroutineScope(Dispatchers.IO).launch {
+// "https://www.worldcitydb.com/search-by-country?lang=ko".getJ().let { doc ->
+// Blog.LOGE("it.title() >> ${doc.title()}")
+// doc.getElementsByTag("tr").forEach { table ->
+// table.children().forEach {
+// it.getElementsByTag("td").forEach { td ->
+// td.children().forEach {
+// if (it.tag().name.equals("a")) {
+// Blog.LOGE("TD>>A ${it}")
+// it.text()
+// }
+// }
+// }
+// }
+// }
+// }
+// }
+// }
+// "loc_ck" -> {
+// FeedsResult().show(supportFragmentManager, "")
+// }
+// "loc_on" -> {
+// PrefBoolean.location.set(!PrefBoolean.location.get())
+// consoleLog("PrefHelper.isLocationOn() >>> ${PrefBoolean.location.get()}")
+// updateLocationService()
+// }
+// "cal" ->{
+// getCal()
+// }
+// "ojs" -> home?.queryInfos(arrayListOf().apply {
+// addAll(RssDataType.values())
+// remove(RssDataType.GURU)
+// remove(RssDataType.MOST)
+// })
+// "all" -> home?.queryInfos(arrayListOf().apply {
+//
+// })
+// "onews" -> home?.queryInfos(arrayListOf().apply {
+// addAll(RssDataType.values())
+// remove(RssDataType.NEWSFEED)
+// })
+// "ored" -> home?.queryInfos(arrayListOf().apply {
+// addAll(RssDataType.values())
+// remove(RssDataType.REDDIT)
+// })
+// "req" -> {
+// refreshFeeds()
+// refreshDeviceData()
+// consoleLog("excute refreshFeeds()")
+// }
+// "reqmax" -> {
+// refreshFeeds()
+// RecentCallGetter.dayRange = 365
+// RecentSmsGetter.dayRange = 365
+// refreshDeviceData()
+// consoleLog("excute refreshFeeds()")
+// }
+//
+// "taxi" -> {
+// consoleLog("before run State home?.binding?.alcholKatalkT?.isVisible >> ${home?.binding?.alcholKatalkT?.isVisible}")
+// home?.showAl()
+// consoleLog("after run State home?.binding?.alcholKatalkT?.isVisible >> ${home?.binding?.alcholKatalkT?.isVisible}")
+// }
+//
+// "tax" -> {
+// consoleLog("before run State home?.binding?.alcholKatalkT?.isVisible >> ${home?.binding?.alcholKatalkT?.isVisible}")
+// home?.hideAl()
+// consoleLog("after run State home?.binding?.alcholKatalkT?.isVisible >> ${home?.binding?.alcholKatalkT?.isVisible}")
+// }
+//
+// "jshow" -> {
+// binding.feedsRss.apply {
+// rss.adapter = mRssAdapter
+// loading.visibility = View.VISIBLE
+// mRssAdapter?.updateData(WorkersDb.getRealm()
+// .query("category == $0 || category == $1", RssDataType.GURU.name, RssDataType.MOST.name)
+// .sort("pubDate", Sort.DESCENDING).find())
+// rss.visibility = View.VISIBLE
+// loading.visibility = View.GONE
+// refresh.visibility = View.GONE
+// }
+// }
+// "jjp" -> {
+//// doWebParseStart("https://projectjav.com") {}
+// }
+// "jmnew" -> {
+//// doWebParseStart("https://missav.com/dm507/en/release") {}
+// }
+// "jmiss" -> {
+//// doWebParseStart("https://missav.com/dm16/en") {}
+// }
+//// "jreq" -> {
+//// consoleLog("current j req() ${WorkersDb.getRealm()
+//// .query("category == $0", RssDataType.GURU.name).find().size}")
+//// CoroutineScope(Dispatchers.IO).launch {
+//// var isOk = false
+////// plist.forEach {
+//// if (!isOk) {
+//// try {
+//// Jsoup.connect(jGuruMain)
+//// .userAgent("Mozilla/5.0 (Linux; Android 13) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.5414.117 Mobile Safari/537.36")
+//// .referrer("http://www.google.com")
+//// .header("Accept-Language", "it-IT,en;q=0.8,en-US;q=0.6,de;q=0.4,it;q=0.2,es;q=0.2")
+//// .header("Connection", "keep-alive")
+//// .header("scheme", "https")
+//// .header("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8")
+//// .header("accept-encoding", "gzip, deflate, br")
+//// .header("cache-control", "no-cache")
+//// .header("pragma", "no-cache")
+//// .header("upgrade-insecure-requests", "1")
+//// .ignoreContentType(true)
+//// .timeout(30000).execute().let {
+//// BLog.LOGE("DOC -> ${it}")
+//// isOk = true
+//// }
+//// } catch (e: Exception) {
+//// e.printStackTrace()
+//// }
+//// }
+////// }
+//// BLog.LOGE("last state ${isOk}")
+//// }
+////// doWebParseStart(jGuruMain,callBack = object : CommadCallabck {
+////// override fun onConsoleLog(log: String) {
+////// this@Feeds.consoleLog(log)
+////// }
+//////
+////// override fun collectComplete() {
+////// consoleLog("excuted j req() ${WorkersDb.getRealm()
+////// .query("category == $0", RssDataType.GURU.name).find().size}")
+////// }
+////// })
+//// }
+////
+//// "jtag" -> {
+////// doWebPare(TEST_PAG.plus("tags")) {
+//// binding.feedsRss.apply {
+//// rss2.adapter = mRssAdapter2
+////
+//// loading.visibility = View.VISIBLE
+//// if (listTags.size > 0) {
+//// mRssAdapter2?.updateData(listTags)
+//// rss2.visibility = View.VISIBLE
+//// loading.visibility = View.GONE
+//// refresh.visibility = View.GONE
+//// } else {
+//// refresh.visibility = View.VISIBLE
+//// rss2.visibility = View.GONE
+//// refresh.setOnClickListener {
+//// doWebParseStart(jGuruMain.plus("tags"), callBack = object : CommadCallabck {
+//// override fun onConsoleLog(log: String) {
+//// this@Feeds.consoleLog(log)
+//// }
+////
+//// override fun collectComplete() {
+//// if (listTags.size > 0) {
+//// rss2?.postDelayed({
+//// mRssAdapter2?.updateData(listTags)
+//// loading.visibility = View.GONE
+//// refresh.visibility = View.GONE
+//// rss2.visibility = View.VISIBLE
+//// }, 500L)
+//// }
+//// }
+//// })
+//// }
+//// }
+//// }
+////// }
+//// }
+//
+// else -> {
+// binding.expandRss.isChecked = false
+// }
+// }
+// }
+//
+// })
+// builder.setNegativeButton(android.R.string.cancel,
+// DialogInterface.OnClickListener { dialog, which -> dialog.cancel() })
+//
+// builder.show()
+//// binding.feedsRss.apply {
+//// if(rss.adapter != null) {
+//// (rss.adapter as RssAdapter).items.clear()
+//// }
+//// }
+//// val rssUrl = lActivity!!.getSharedPreferences(PREFS_SETTINGS, 0)
+//// .getString(KEY_RSS_URL, "")
+//// when {
+//// isNetworkAvailable && !rssUrl.isNullOrEmpty() -> {
+////// Intent(lActivity!!, RssService::class.java)
+////// .putExtra(RSS_RECEIVER, resultReceiver).let {
+////// enqueueWork(lActivity!!, RssService::class.java, rssJobId, it)
+////// }
+//// }
+//// else -> resumeService()
+//// }
+//// val rssUrl2 = lActivity!!.getSharedPreferences(PREFS_SETTINGS, 0)
+//// .getString(KEY_RSS_URL2, "")
+//// when {
+//// isNetworkAvailable && !rssUrl2.isNullOrEmpty() -> {
//// Intent(lActivity!!, RssService::class.java)
//// .putExtra(RSS_RECEIVER, resultReceiver).let {
//// enqueueWork(lActivity!!, RssService::class.java, rssJobId, it)
//// }
-// }
-// else -> resumeService()
-// }
-// val rssUrl2 = lActivity!!.getSharedPreferences(PREFS_SETTINGS, 0)
-// .getString(KEY_RSS_URL2, "")
-// when {
-// isNetworkAvailable && !rssUrl2.isNullOrEmpty() -> {
-// Intent(lActivity!!, RssService::class.java)
-// .putExtra(RSS_RECEIVER, resultReceiver).let {
-// enqueueWork(lActivity!!, RssService::class.java, rssJobId, it)
-// }
-// }
-// else -> resumeService()
-// }
- }
-
- /* retry to start rss service */
- private fun resumeService() {
- binding.feedsRss.apply {
- rss.visibility = View.GONE
- loading.visibility = View.GONE
- refresh.visibility = View.VISIBLE
- refresh.setOnClickListener {
- mRssAdapter?.notifyDataSetChanged()
- }
- }
- }
-
-
- private fun systemInfo() {
-// viewLifecycleOwner.lifecycleScope.launch {
-// repeatOnLifecycle(Lifecycle.State.RESUMED) {
- SystemStats().apply {
- intStorage(binding.feedsSysInfos.intParent)
- extStorage(binding.feedsSysInfos.extParent)
-// while (isActive) {
- ram(binding.feedsSysInfos.ramParent)
- cpu(binding.feedsSysInfos.cpuParent)
- misc(binding.feedsSysInfos.misc)
-// delay(1000)
-// }
- }
- }
-// }
+//// }
+//// else -> resumeService()
+//// }
// }
-
-// private fun selectWidget() {
-// Intent(AppWidgetManager.ACTION_APPWIDGET_PICK).apply {
-// putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetHost?.allocateAppWidgetId())
-// putParcelableArrayListExtra(AppWidgetManager.EXTRA_CUSTOM_INFO, ArrayList())
-// putParcelableArrayListExtra(AppWidgetManager.EXTRA_CUSTOM_EXTRAS, ArrayList())
-// putExtra(requestCodeString, requestPickWidget)
-// }.let { widgetPicker.launch(it) }
-// }
-
-// private val widgetPicker =
-// registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
-// val data = result.data
-// val appWidgetId = data?.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1)
-// if (result.resultCode == RESULT_OK) {
-// when (data?.getIntExtra(requestCodeString, requestPickWidget)) {
-// requestPickWidget -> configureWidget(appWidgetId!!)
-// requestCreateWidget -> createWidget(appWidgetId!!, null)
-// }
-// } else if (result.resultCode == RESULT_CANCELED && data != null) {
-// if (appWidgetId != -1) appWidgetHost?.deleteAppWidgetId(appWidgetId!!)
-// }
-// }
//
-// private fun configureWidget(appWidgetId: Int) {
-// when (val appWidgetConfig = appWidgetManager!!.getAppWidgetInfo(appWidgetId).configure) {
-// null -> createWidget(appWidgetId, null)
-// else -> {
-// Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE).apply {
-// component = appWidgetConfig
-// putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
-// putExtra(requestCodeString, requestCreateWidget)
-// }.let {
-// try { widgetPicker.launch(it) }
-// catch (e: Exception) { e.printStackTrace() }
-// }
+// /* retry to start rss service */
+// private fun resumeService() {
+// binding.feedsRss.apply {
+// rss.visibility = View.GONE
+// loading.visibility = View.GONE
+// refresh.visibility = View.VISIBLE
+// refresh.setOnClickListener {
+// mRssAdapter?.notifyDataSetChanged()
// }
// }
// }
//
-// private fun createWidget(appWidgetId: Int, height: Int?) {
-// if (appWidgetId == -1) return
//
-// val appWidgetInfo = appWidgetManager!!.getAppWidgetInfo(appWidgetId)
-// val params: ConstraintLayout.LayoutParams?
-//
-// when (height) {
-// null -> {
-// params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, appWidgetInfo.minHeight)
-// val updatedIds = splitWidgetIds.plus("$appWidgetId")
-// val updatedHeights = splitWidgetHeights.plus("${appWidgetInfo.minHeight}")
-// saveWidgetData(updatedIds, updatedHeights)
-// }
-// else -> params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, height)
+// private fun systemInfo() {
+//// viewLifecycleOwner.lifecycleScope.launch {
+//// repeatOnLifecycle(Lifecycle.State.RESUMED) {
+// SystemStats().apply {
+// intStorage(binding.feedsSysInfos.intParent)
+// extStorage(binding.feedsSysInfos.extParent)
+//// while (isActive) {
+// ram(binding.feedsSysInfos.ramParent)
+// cpu(binding.feedsSysInfos.cpuParent)
+// misc(binding.feedsSysInfos.misc)
+//// delay(1000)
+//// }
// }
+// }
+//// }
+//// }
//
-// (appWidgetHost?.createView(lActivity!!.applicationContext, appWidgetId, appWidgetInfo) as WidgetHostView)
-// .apply {
-// setAppWidget(appWidgetId, appWidgetInfo)
-// }.let {
-// binding.widgetContainer.addView(it, params)
-// widgetMenu(it)
-// }
+//// private fun selectWidget() {
+//// Intent(AppWidgetManager.ACTION_APPWIDGET_PICK).apply {
+//// putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetHost?.allocateAppWidgetId())
+//// putParcelableArrayListExtra(AppWidgetManager.EXTRA_CUSTOM_INFO, ArrayList())
+//// putParcelableArrayListExtra(AppWidgetManager.EXTRA_CUSTOM_EXTRAS, ArrayList())
+//// putExtra(requestCodeString, requestPickWidget)
+//// }.let { widgetPicker.launch(it) }
+//// }
+//
+//// private val widgetPicker =
+//// registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
+//// val data = result.data
+//// val appWidgetId = data?.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1)
+//// if (result.resultCode == RESULT_OK) {
+//// when (data?.getIntExtra(requestCodeString, requestPickWidget)) {
+//// requestPickWidget -> configureWidget(appWidgetId!!)
+//// requestCreateWidget -> createWidget(appWidgetId!!, null)
+//// }
+//// } else if (result.resultCode == RESULT_CANCELED && data != null) {
+//// if (appWidgetId != -1) appWidgetHost?.deleteAppWidgetId(appWidgetId!!)
+//// }
+//// }
+////
+//// private fun configureWidget(appWidgetId: Int) {
+//// when (val appWidgetConfig = appWidgetManager!!.getAppWidgetInfo(appWidgetId).configure) {
+//// null -> createWidget(appWidgetId, null)
+//// else -> {
+//// Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE).apply {
+//// component = appWidgetConfig
+//// putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
+//// putExtra(requestCodeString, requestCreateWidget)
+//// }.let {
+//// try { widgetPicker.launch(it) }
+//// catch (e: Exception) { e.printStackTrace() }
+//// }
+//// }
+//// }
+//// }
+////
+//// private fun createWidget(appWidgetId: Int, height: Int?) {
+//// if (appWidgetId == -1) return
+////
+//// val appWidgetInfo = appWidgetManager!!.getAppWidgetInfo(appWidgetId)
+//// val params: ConstraintLayout.LayoutParams?
+////
+//// when (height) {
+//// null -> {
+//// params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, appWidgetInfo.minHeight)
+//// val updatedIds = splitWidgetIds.plus("$appWidgetId")
+//// val updatedHeights = splitWidgetHeights.plus("${appWidgetInfo.minHeight}")
+//// saveWidgetData(updatedIds, updatedHeights)
+//// }
+//// else -> params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, height)
+//// }
+////
+//// (appWidgetHost?.createView(lActivity!!.applicationContext, appWidgetId, appWidgetInfo) as WidgetHostView)
+//// .apply {
+//// setAppWidget(appWidgetId, appWidgetInfo)
+//// }.let {
+//// binding.widgetContainer.addView(it, params)
+//// widgetMenu(it)
+//// }
+//// }
+////
+//// private fun updateWidgets() {
+//// if (splitWidgetIds.size > 0) {
+//// viewLifecycleOwner.lifecycleScope.launch {
+//// binding.widgetContainer.removeAllViews()
+//// splitWidgetIds.indices.forEach { i: Int ->
+//// createWidget(splitWidgetIds[i]!!.int(), splitWidgetHeights[i]!!.int())
+//// }
+//// }
+//// }
+//// }
+////
+//// private fun widgetMenu(hostView: WidgetHostView) {
+//// val appWidgetId = hostView.appWidgetId
+//// hostView.setOnLongClickListener {
+//// PopupMenu(requireContext(), it, Gravity.END).apply {
+//// menuInflater.inflate(R.menu.widget_menu, this.menu)
+//// show()
+//// setOnMenuItemClickListener { menuItem ->
+//// when (menuItem.itemId) {
+//// R.id.move_up -> moveWidget(appWidgetId, true)
+//// R.id.move_down -> moveWidget(appWidgetId, false)
+//// R.id.increase_height -> resizeWidget(appWidgetId, true)
+//// R.id.decrease_height -> resizeWidget(appWidgetId, false)
+//// R.id.delete_widget -> removeWidget(it as WidgetHostView)
+//// }
+//// false
+//// }
+//// }
+//// true
+//// }
+//// }
+////
+//// private fun moveWidget(widgetId: Int, moveUp: Boolean) {
+//// val tempIds = splitWidgetIds
+//// val tempHeights = splitWidgetHeights
+////
+//// splitWidgetIds.indexOf(widgetId.toString()).let { i ->
+//// when {
+//// moveUp && i > 0 -> {
+//// tempIds.swap(i-1, i)
+//// tempHeights.swap(i-1, i)
+//// }
+//// !moveUp && i < splitWidgetIds.size - 1 -> {
+//// tempIds.swap(i, i+1)
+//// tempHeights.swap(i, i+1)
+//// }
+//// else -> return
+//// }
+//// }
+////
+//// saveWidgetData(tempIds, tempHeights)
+//// updateWidgets()
+//// }
+////
+//// private fun resizeWidget(widgetId: Int, shouldAdd: Boolean) {
+//// val tempList = splitWidgetHeights
+////
+//// splitWidgetIds.indexOf(widgetId.toString()).let { i ->
+//// tempList[i] = when (shouldAdd) {
+//// true -> (splitWidgetHeights[i]!!.int().plus(50)).toString()
+//// false -> (splitWidgetHeights[i]!!.int().minus(50)).toString()
+//// }
+//// }
+////
+//// widgetPref.edit().putString(KEY_WIDGET_HEIGHTS, tempList.joinToString(separator = SEPARATOR)).apply()
+//// updateWidgets()
+//// }
+////
+//// private fun removeWidget(hostView: WidgetHostView) {
+//// hostView.let { v ->
+//// appWidgetHost?.deleteAppWidgetId(v.appWidgetId)
+//// binding.widgetContainer.removeView(v)
+////
+//// splitWidgetIds.indexOf(v.appWidgetId.toString()).let { i ->
+//// saveWidgetData(splitWidgetIds.minus(splitWidgetIds[i]), splitWidgetHeights.minus(splitWidgetHeights[i]))
+//// }
+//// }
+//// }
+////
+//// private fun saveWidgetData(idList: List, heightList: List) {
+//// widgetPref.edit()
+//// .putString(KEY_WIDGET_IDS, idList.joinToString(separator = SEPARATOR))
+//// .putString(KEY_WIDGET_HEIGHTS, heightList.joinToString(separator = SEPARATOR))
+//// .apply()
+//// }
+//
+// private val widgetPref: SharedPreferences get() = lActivity!!.getSharedPreferences(PREFS_WIDGETS, 0)
+// private val widgetIds: String? get() = widgetPref.getString(KEY_WIDGET_IDS, "")
+// private val widgetHeights: String? get() = widgetPref.getString(KEY_WIDGET_HEIGHTS, "")
+// private val splitWidgetIds: MutableList get() = widgetIds!!.split(SEPARATOR).toMutableList()
+// private val splitWidgetHeights: MutableList get() = widgetHeights!!.split(SEPARATOR).toMutableList()
+//
+// private fun MutableList.swap(index1: Int, index2: Int){
+// val temp = this[index1]
+// this[index1] = this[index2]
+// this[index2] = temp
// }
//
-// private fun updateWidgets() {
-// if (splitWidgetIds.size > 0) {
-// viewLifecycleOwner.lifecycleScope.launch {
-// binding.widgetContainer.removeAllViews()
-// splitWidgetIds.indices.forEach { i: Int ->
-// createWidget(splitWidgetIds[i]!!.int(), splitWidgetHeights[i]!!.int())
-// }
-// }
+// private fun String.int() : Int {
+// return try {
+// this.toInt()
+// } catch (e: Exception) {
+// -1
// }
// }
//
-// private fun widgetMenu(hostView: WidgetHostView) {
-// val appWidgetId = hostView.appWidgetId
-// hostView.setOnLongClickListener {
-// PopupMenu(requireContext(), it, Gravity.END).apply {
-// menuInflater.inflate(R.menu.widget_menu, this.menu)
-// show()
-// setOnMenuItemClickListener { menuItem ->
-// when (menuItem.itemId) {
-// R.id.move_up -> moveWidget(appWidgetId, true)
-// R.id.move_down -> moveWidget(appWidgetId, false)
-// R.id.increase_height -> resizeWidget(appWidgetId, true)
-// R.id.decrease_height -> resizeWidget(appWidgetId, false)
-// R.id.delete_widget -> removeWidget(it as WidgetHostView)
-// }
-// false
-// }
-// }
-// true
-// }
-// }
-//
-// private fun moveWidget(widgetId: Int, moveUp: Boolean) {
-// val tempIds = splitWidgetIds
-// val tempHeights = splitWidgetHeights
-//
-// splitWidgetIds.indexOf(widgetId.toString()).let { i ->
-// when {
-// moveUp && i > 0 -> {
-// tempIds.swap(i-1, i)
-// tempHeights.swap(i-1, i)
-// }
-// !moveUp && i < splitWidgetIds.size - 1 -> {
-// tempIds.swap(i, i+1)
-// tempHeights.swap(i, i+1)
-// }
-// else -> return
-// }
-// }
-//
-// saveWidgetData(tempIds, tempHeights)
-// updateWidgets()
-// }
-//
-// private fun resizeWidget(widgetId: Int, shouldAdd: Boolean) {
-// val tempList = splitWidgetHeights
-//
-// splitWidgetIds.indexOf(widgetId.toString()).let { i ->
-// tempList[i] = when (shouldAdd) {
-// true -> (splitWidgetHeights[i]!!.int().plus(50)).toString()
-// false -> (splitWidgetHeights[i]!!.int().minus(50)).toString()
-// }
-// }
-//
-// widgetPref.edit().putString(KEY_WIDGET_HEIGHTS, tempList.joinToString(separator = SEPARATOR)).apply()
-// updateWidgets()
-// }
-//
-// private fun removeWidget(hostView: WidgetHostView) {
-// hostView.let { v ->
-// appWidgetHost?.deleteAppWidgetId(v.appWidgetId)
-// binding.widgetContainer.removeView(v)
-//
-// splitWidgetIds.indexOf(v.appWidgetId.toString()).let { i ->
-// saveWidgetData(splitWidgetIds.minus(splitWidgetIds[i]), splitWidgetHeights.minus(splitWidgetHeights[i]))
-// }
-// }
-// }
-//
-// private fun saveWidgetData(idList: List, heightList: List) {
-// widgetPref.edit()
-// .putString(KEY_WIDGET_IDS, idList.joinToString(separator = SEPARATOR))
-// .putString(KEY_WIDGET_HEIGHTS, heightList.joinToString(separator = SEPARATOR))
-// .apply()
-// }
-
- private val widgetPref: SharedPreferences get() = lActivity!!.getSharedPreferences(PREFS_WIDGETS, 0)
- private val widgetIds: String? get() = widgetPref.getString(KEY_WIDGET_IDS, "")
- private val widgetHeights: String? get() = widgetPref.getString(KEY_WIDGET_HEIGHTS, "")
- private val splitWidgetIds: MutableList get() = widgetIds!!.split(SEPARATOR).toMutableList()
- private val splitWidgetHeights: MutableList get() = widgetHeights!!.split(SEPARATOR).toMutableList()
-
- private fun MutableList.swap(index1: Int, index2: Int){
- val temp = this[index1]
- this[index1] = this[index2]
- this[index2] = temp
- }
-
- private fun String.int() : Int {
- return try {
- this.toInt()
- } catch (e: Exception) {
- -1
- }
- }
-
-}
+//}
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/GeckoWeb.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/GeckoWeb.kt
new file mode 100644
index 00000000..81c53d8c
--- /dev/null
+++ b/app/src/main/kotlin/bums/lunatic/launcher/home/GeckoWeb.kt
@@ -0,0 +1,473 @@
+package bums.lunatic.launcher.home
+
+import android.content.Context
+import android.os.Handler
+import android.os.Looper
+import android.os.Message
+import android.util.AttributeSet
+import android.util.Log
+import android.view.KeyEvent
+import android.view.KeyEvent.ACTION_UP
+import android.view.KeyEvent.KEYCODE_BUTTON_A
+import android.view.KeyEvent.KEYCODE_BUTTON_B
+import android.view.KeyEvent.KEYCODE_BUTTON_SELECT
+import android.view.KeyEvent.KEYCODE_BUTTON_START
+import android.view.KeyEvent.KEYCODE_BUTTON_X
+import android.view.KeyEvent.KEYCODE_BUTTON_Y
+import android.view.KeyEvent.KEYCODE_DPAD_DOWN
+import android.view.KeyEvent.KEYCODE_DPAD_UP
+import bums.lunatic.launcher.utils.Blog
+import com.google.gson.Gson
+import org.json.JSONObject
+import org.mozilla.gecko.util.ThreadUtils
+import org.mozilla.geckoview.ExperimentDelegate
+import org.mozilla.geckoview.GeckoResult
+import org.mozilla.geckoview.GeckoRuntime
+import org.mozilla.geckoview.GeckoRuntimeSettings
+import org.mozilla.geckoview.GeckoSession
+import org.mozilla.geckoview.GeckoView
+import org.mozilla.geckoview.MediaSession
+import org.mozilla.geckoview.WebExtension
+import org.mozilla.geckoview.WebExtension.MessageDelegate
+import org.mozilla.geckoview.WebExtension.PortDelegate
+import org.mozilla.geckoview.WebExtensionController.AddonManagerDelegate
+import org.mozilla.geckoview.WebRequestError
+
+class GeckoWeb : GeckoView {
+ constructor(context: Context?) : super(context) {
+ initWithContext(context)
+ }
+ constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {
+ initWithContext(context)
+ }
+
+ fun loadUrl(url: String) {
+ Blog.LOGE("url >>>> ${url}")
+ if (url.split("//").size > 1) {
+ url.replace("//","/").replace("https:/","https://").let {
+ Blog.LOGE("url >> ${url} , it >>> ${it}")
+ this.session?.loadUri(url)
+ }
+ } else {
+ this.session?.loadUri(url)
+ }
+
+ currentRetryCount = 0;
+ }
+ val handle = object : Handler(Looper.getMainLooper()) {
+ override fun handleMessage(msg: Message) {
+ if (msg.what == 0) {
+ (msg.obj as? ReaderConfig)?.let {
+ }
+ }
+ }
+ }
+
+ var lastedUrl: String? = null
+ var canGoBack: Boolean? = null
+ var mPort: WebExtension.Port? = null
+
+ object WebExtensionInfo {
+ val mPortNam = "browser"
+ val extPath = "resource://android/assets/extensions/my_extension/"
+ val extId = "messaging@booktoki468.com"
+ }
+
+ var mExtension: WebExtension? = null
+ var mSession: GeckoSession? = null
+ val addonManagerDelegate = object : AddonManagerDelegate {
+ override fun onReady(extension: WebExtension) {
+ Blog.LOGE("onReady ${extension.id} from WebExtension")
+ mExtension = extension
+ }
+
+ override fun onEnabling(extension: WebExtension) {
+ Blog.LOGE("onEnabling ${extension.id} from WebExtension")
+ }
+
+ override fun onEnabled(extension: WebExtension) {
+ Blog.LOGE("onEnabled ${extension.id} from WebExtension")
+ mExtension = extension
+
+ }
+ }
+ private fun initWithContext(context: Context?) {
+ context?.let { context ->
+ initGeckoRuntime(context)
+ mSession = GeckoSession()
+ mSession?.contentDelegate = contentDelegate
+ mSession?.progressDelegate = progressDelegate
+ mSession?.navigationDelegate = navigationDelegate
+ sRuntime?.apply {
+ webExtensionController.setAddonManagerDelegate(addonManagerDelegate)
+ webExtensionController.ensureBuiltIn(WebExtensionInfo.extPath, WebExtensionInfo.extId)
+ .accept( // Register message delegate for background script
+ { extension: WebExtension? ->
+ ThreadUtils.runOnUiThread(Runnable { mSession?.let{session-> extension?.let { session.webExtensionController.setMessageDelegate(it,messageDelegate,WebExtensionInfo.mPortNam) }} })
+ },
+ { e: Throwable? -> Log.e("MessageDelegate", "Error registering WebExtension", e) })
+
+ mSession?.mediaDelegate = mediaDelegate
+ mSession?.mediaSessionDelegate = mediaSessionDelegate
+ mSession?.open(sRuntime!!)
+
+ }.let {
+ this.setSession(mSession!!)
+ this.loadUrl("https://booktoki468.com") // Or any other URL...
+ }
+ }
+ }
+ val mediaDelegate = object : GeckoSession.MediaDelegate {
+ override fun onRecordingStatusChanged(
+ session: GeckoSession,
+ devices: Array
+ ) {
+ super.onRecordingStatusChanged(session, devices)
+ }
+ }
+ val mediaSessionDelegate = object : MediaSession.Delegate {
+ override fun onActivated(
+ session: GeckoSession,
+ mediaSession: MediaSession
+ ) {
+ Blog.LOGE("onActivated")
+ super.onActivated(session, mediaSession)
+ }
+
+ override fun onDeactivated(
+ session: GeckoSession,
+ mediaSession: MediaSession
+ ) {
+ Blog.LOGE("onDeactivated")
+ super.onDeactivated(session, mediaSession)
+ }
+
+ override fun onMetadata(
+ session: GeckoSession,
+ mediaSession: MediaSession,
+ meta: MediaSession.Metadata
+ ) {
+ Blog.LOGE("onMetadata ${Gson().toJson(meta)}")
+ super.onMetadata(session, mediaSession, meta)
+ }
+
+ override fun onFeatures(
+ session: GeckoSession,
+ mediaSession: MediaSession,
+ features: Long
+ ) {
+ Blog.LOGE("onFeatures $features")
+ super.onFeatures(session, mediaSession, features)
+ }
+
+ override fun onPlay(
+ session: GeckoSession,
+ mediaSession: MediaSession
+ ) {
+ Blog.LOGE("onPlay")
+ super.onPlay(session, mediaSession)
+ }
+
+ override fun onPause(
+ session: GeckoSession,
+ mediaSession: MediaSession
+ ) {
+ Blog.LOGE("onPause")
+ super.onPause(session, mediaSession)
+ }
+
+ override fun onStop(
+ session: GeckoSession,
+ mediaSession: MediaSession
+ ) {
+ Blog.LOGE("onStop")
+ super.onStop(session, mediaSession)
+ }
+
+ override fun onPositionState(
+ session: GeckoSession,
+ mediaSession: MediaSession,
+ state: MediaSession.PositionState
+ ) {
+ Blog.LOGE("onPositionState $state")
+ super.onPositionState(session, mediaSession, state)
+ }
+
+ override fun onFullscreen(
+ session: GeckoSession,
+ mediaSession: MediaSession,
+ enabled: Boolean,
+ meta: MediaSession.ElementMetadata?
+ ) {
+ Blog.LOGE("onFullscreen $Boolean ${Gson().toJson(meta)}")
+ super.onFullscreen(session, mediaSession, enabled, meta)
+ }
+ }
+ private fun initGeckoRuntime(context : Context) {
+ if (sRuntime == null) {
+ try {
+ val settings: GeckoRuntimeSettings =
+ GeckoRuntimeSettings.Builder().extensionsProcessEnabled(true)
+ .extensionsWebAPIEnabled(true)
+ .experimentDelegate(experimentDelegate)
+ .remoteDebuggingEnabled(true).build()
+
+ sRuntime = GeckoRuntime.create(context, settings)
+ } catch (e: Exception) {
+
+ }
+ }
+ }
+
+ val experimentDelegate = object : ExperimentDelegate {
+ override fun onGetExperimentFeature(feature: String): GeckoResult {
+ Blog.LOGE("onGetExperimentFeature $feature")
+ return super.onGetExperimentFeature(feature)
+ }
+
+ override fun onRecordExposureEvent(feature: String): GeckoResult {
+ Blog.LOGE("onRecordExposureEvent $feature")
+ return super.onRecordExposureEvent(feature)
+ }
+
+ override fun onRecordExperimentExposureEvent(
+ feature: String,
+ slug: String
+ ): GeckoResult {
+ Blog.LOGE("onRecordExperimentExposureEvent $feature , $slug")
+ return super.onRecordExperimentExposureEvent(feature, slug)
+ }
+
+ override fun onRecordMalformedConfigurationEvent(
+ feature: String,
+ part: String
+ ): GeckoResult {
+ Blog.LOGE("onRecordMalformedConfigurationEvent $feature , $part")
+ return super.onRecordMalformedConfigurationEvent(feature, part)
+ }
+ }
+ val contentDelegate = object : GeckoSession.ContentDelegate {
+ override fun onTitleChange(
+ session: GeckoSession,
+ title: String?
+ ) {
+ Blog.LOGE("onTitleChange $title")
+ super.onTitleChange(session, title)
+ }
+
+ override fun onCrash(session: GeckoSession) {
+ Blog.LOGE("onCrash")
+ super.onCrash(session)
+ }
+
+ override fun onPaintStatusReset(session: GeckoSession) {
+ Blog.LOGE("onPaintStatusReset")
+ super.onPaintStatusReset(session)
+ }
+
+ override fun onFirstContentfulPaint(session: GeckoSession) {
+ Blog.LOGE("onFirstContentfulPaint")
+ super.onFirstContentfulPaint(session)
+ }
+ }
+ val progressDelegate = object : GeckoSession.ProgressDelegate {
+ override fun onSecurityChange(
+ session: GeckoSession,
+ securityInfo: GeckoSession.ProgressDelegate.SecurityInformation
+ ) {
+ Blog.LOGE("onSecurityChange $securityInfo from WebExtension")
+ super.onSecurityChange(session, securityInfo)
+ }
+
+ override fun onSessionStateChange(
+ session: GeckoSession,
+ sessionState: GeckoSession.SessionState
+ ) {
+ Blog.LOGE("onSessionStateChange $sessionState from WebExtension")
+ super.onSessionStateChange(session, sessionState)
+ }
+
+ override fun onPageStart(session: GeckoSession, url: String) {
+ super.onPageStart(session, url)
+ }
+
+ override fun onPageStop(session: GeckoSession, success: Boolean) {
+ Blog.LOGE("onPageStop $success from WebExtension")
+ super.onPageStop(session, success)
+ if (success && mPort != null) {
+ if (mPort == null) {
+ // No extension registered yet, let's ignore this message
+ return
+ }
+
+ }
+ }
+ }
+
+ val navigationDelegate = object : GeckoSession.NavigationDelegate {
+ override fun onLoadError(
+ session: GeckoSession,
+ uri: String?,
+ error: WebRequestError
+ ): GeckoResult? {
+ error.printStackTrace()
+ Blog.LOGE("onLoadError >>> ${uri} ::>> ${error.category} , ${error.code}")
+ if (error.code == WebRequestError.ERROR_NET_RESET) {
+
+ }
+ return super.onLoadError(session, uri, error)
+ }
+
+ override fun onNewSession(
+ session: GeckoSession,
+ uri: String
+ ): GeckoResult? {
+ Blog.LOGE("GeckoView", "onNewSession: $session from WebExtension")
+
+
+ return super.onNewSession(session, uri)
+ }
+
+ override fun onLocationChange(
+ session: GeckoSession,
+ url: String?,
+ perms: MutableList,
+ hasUserGesture: Boolean
+ ) {
+ // url이 현재 로드된 주소입니다.
+ Blog.LOGE("GeckoView", "현재 주소: $url")
+ Blog.LOGE("GeckoView", "현재 session: $session")
+ url?.let { url ->
+ if (url.split("//").size > 1) {
+ url.replace("//", "/").replace("https:/", "https://").let {
+ Blog.LOGE("url >> ${url} , it >>> ${it}")
+ lastedUrl = url
+ }
+ } else {
+ lastedUrl = url
+ }
+ }
+
+ }
+
+ override fun onCanGoBack(session: GeckoSession, canGoBack: Boolean) {
+ super.onCanGoBack(session, canGoBack)
+ this@GeckoWeb.canGoBack = canGoBack
+ if (canGoBack) {
+
+ }
+ }
+
+ }
+
+ val portDelegate: PortDelegate =
+ object : PortDelegate {
+ override fun onPortMessage(
+ message: Any, port: WebExtension.Port
+ ) {
+ Blog.LOGE("PortDelegate", "Received message from extension: $message")
+
+ }
+
+
+ override fun onDisconnect(port: WebExtension.Port) {
+ // This port is not usable anymore.
+ if (port === mPort) {
+ mPort = null
+ }
+ }
+ }
+
+ val messageDelegate: MessageDelegate =
+ object : MessageDelegate {
+ override fun onConnect(port: WebExtension.Port) {
+ mPort = port
+ mPort!!.setDelegate(portDelegate)
+ }
+
+ override fun onMessage(
+ nativeApp: String,
+ message: Any,
+ sender: WebExtension.MessageSender
+ ): GeckoResult? {
+ Blog.LOGE(
+ "messageDelegate",
+ "onMessage from WebExtension: ${nativeApp} , $message , ${sender.webExtension.id}"
+ )
+ return super.onMessage(nativeApp, message, sender)
+ }
+
+
+ }
+
+
+ fun onStart() {
+
+ }
+
+ fun onResume() {
+
+
+ }
+
+
+ fun onDestroy() {
+ sRuntime = null
+ }
+
+
+
+ override fun dispatchKeyEvent(ev: KeyEvent): Boolean {
+ Blog.LOGE("dispatch ev?.device?.name >>> ${ev?.device?.name}")
+ if (ev?.device?.name?.contains("SM-031N Mouse") == true) {
+ when (ev.action) {
+ ACTION_UP -> {
+ Blog.LOGE("dispatch dispatchKeyEvent>>> ${ev}")
+ when (ev.keyCode) {
+ KEYCODE_BUTTON_Y -> {
+ }
+
+ KEYCODE_BUTTON_X -> {
+
+ }
+
+ KEYCODE_BUTTON_A -> {
+ }
+
+ KEYCODE_BUTTON_B -> {
+
+ }
+
+ KEYCODE_DPAD_DOWN -> {
+
+ }
+
+ KEYCODE_DPAD_UP -> {
+
+ }
+
+ KEYCODE_BUTTON_START -> {
+ }
+
+ KEYCODE_BUTTON_SELECT -> {
+
+ }
+
+ else -> {}
+ }
+ }
+
+ else -> {}
+ }
+ return true
+ }
+ return super.dispatchKeyEvent(ev)
+ }
+
+
+ companion object {
+ private const val TAG = "DualScreenStatus"
+ var sRuntime: GeckoRuntime? = null
+ var currentRetryCount = 0
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/LauncherHome.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/LauncherHome.kt
index e27f07dc..d34dc06c 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/home/LauncherHome.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/home/LauncherHome.kt
@@ -127,60 +127,31 @@ internal class LauncherHome : Fragment() {
lateinit var binding: LauncherHomeBinding
private lateinit var fragManager: FragmentManager
private lateinit var settingsPrefs: SharedPreferences
- private lateinit var batteryReceiver: BatteryReceiver
private var shouldResume = true
companion object {
var home: LauncherHome? = null
var lastedFinishedPageUrl: String = ""
- var listTags = arrayListOf()
}
val UPDATE_DELAY = 5L
val commandHandler = Handler(Looper.getMainLooper())
val infoUpdate = Runnable { chooseAdpater() }
- val notiUpdate = Runnable { chooseAdpater() }
-
- var weatherJob: Job? = null
var result: RealmResults? = null
- val hideListViewTime = 1000L * 60L * 15L
- val hideListView = {
-// binding.notiList.visibility = View.GONE
-// binding.mainList.visibility = View.GONE
-// binding.infoList.visibility = View.GONE
-// binding.smsList.visibility = View.GONE
-// binding.otherCheck.isSelected = false
-// binding.recentSms.isSelected = false
-// binding.missedCalls.isSelected = false
-// binding.notice.isSelected = false
- }
-
val nomoreShowCount = 5
fun rssStateVote() = (lasted?.filter { it.vote == true }?.size ?: -1) == (lasted?.size ?: 0)
-
var lasted: List? = null
- var lastedNoti: List? = null
var infosJob: Job? = null
- var noticeJob: Job? = null
-
- lateinit var mRecentCallsAdapter: RecentCallsAdapter
- lateinit var mSmsLogsAdapter: SmsLogsAdapter
lateinit var mRssAdapter: RssItemAdapter
- lateinit var mNotiAdapter: NotificationItemAdapter
- lateinit var mAppsAdapter: AppsAdapter
- var mWeatherAdapter: WeatherAdapter? = null
- var weatherDressAdapter: WeatherDressAdatper? = null
- var weatherHourlyAdapter: WeatherHourlyAdapter? = null
+
var mRssDataResult: RealmResults? = null
- var mNotificationResult: RealmResults? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
home = this
}
- var musicJob: Job? = null
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
@@ -189,359 +160,20 @@ internal class LauncherHome : Fragment() {
binding = LauncherHomeBinding.inflate(inflater, container, false)
fragManager = lActivity!!.supportFragmentManager
settingsPrefs = requireContext().getSharedPreferences(PREFS_SETTINGS, 0)
- batteryReceiver = BatteryReceiver(binding.batteryProgress)
- mRecentCallsAdapter = RecentCallsAdapter(arrayListOf(), requireContext())
- mSmsLogsAdapter = SmsLogsAdapter(arrayListOf(), requireContext())
- mNotiAdapter = NotificationItemAdapter(requireContext())
- mAppsAdapter = AppsAdapter(requireContext().packageManager , fragManager, null)
mRssAdapter = RssItemAdapter(requireContext())
-
- weatherDressAdapter = WeatherDressAdatper(arrayListOf())
- weatherHourlyAdapter = WeatherHourlyAdapter(arrayListOf())
-
-
- var weatherPages = arrayListOf()
- var weatherAdapter = arrayListOf?>()
- (PrefBoolean.weatherDress.get(false) || PrefBoolean.weatherState.get(false)).letTrue {
- PrefBoolean.weatherDress.get(false).letTrue { weatherPages.add(R.layout.hourly_weather); weatherAdapter.add(weatherDressAdapter!!) }
- PrefBoolean.weatherState.get(false).letTrue { weatherPages.add(R.layout.recommended_hourly_dress); weatherAdapter.add(weatherHourlyAdapter!!) }
- binding.weathers.root.visibility = View.VISIBLE
- mWeatherAdapter = WeatherAdapter(weatherPages, adatpers = weatherAdapter, binding.weathers)
- binding.weathers.weatherViewPager.offscreenPageLimit = 2
- }
-
val decoration = DividerItemDecoration(requireContext(), DividerItemDecoration.VERTICAL)
-
- binding.notiList.addItemDecoration(decoration)
binding.infoList.addItemDecoration(decoration)
-
- binding.smsList.visibility = View.GONE
- binding.infoList.visibility = View.GONE
-
- binding.weathers.weatherViewPager.orientation = ViewPager2.ORIENTATION_VERTICAL
-
- binding.mainList.adapter = mRecentCallsAdapter
- binding.smsList.adapter = mSmsLogsAdapter
+ binding.infoList.visibility = View.VISIBLE
binding.infoList.adapter = mRssAdapter
- binding.notiList.adapter = mNotiAdapter
- binding.appsList.adapter = mAppsAdapter
- binding.weathers.weatherViewPager.adapter = mWeatherAdapter
- binding.weathers.weatherViewPager.registerOnPageChangeCallback(object :
- ViewPager2.OnPageChangeCallback() {
- override fun onPageSelected(position: Int) {
- super.onPageSelected(position)
- // 페이지가 변경될 때 호출됨
- mWeatherAdapter?.syncScroll(position)
-
- }
-
- })
-
- binding.favApps.setOnLongClickListener {
- RssViewBuilder(lActivity!!)
- .setRssId("https://jav.guru")
- .webViewDomStorageEnabled(true)
- .webViewJavaScriptEnabled(true)
- .webViewUserAgentAppend(false)
- .webViewAllowContentAccess(true)
- .webViewCookieEnabled(true)
- .webViewCacheMode(LOAD_NO_CACHE)
- .webViewUserAgentString(USAGT)
- .webViewMixedContentMode(MIXED_CONTENT_ALWAYS_ALLOW)
- .showIconClose(true)
- .showIconBack(false)
- .showProgressBar(true)
- .backPressToClose(false)
- .webViewCookieEnabled(true)
- .show("https://jav.guru")
- true
- }
-
- binding.missedCalls.setOnLongClickListener {
-// lActivity?.startActivity(Intent(lActivity, PhotoFilter::class.java))
-// RssViewBuilder(lActivity!!)
-// .setRssId("https://booktoki468.com/")
-// .webViewMixedContentMode(MIXED_CONTENT_ALWAYS_ALLOW)
-// .webViewCacheMode(LOAD_NO_CACHE)
-// .webViewJavaScriptEnabled(true)
-// .webViewUserAgentAppend(false)
-// .webViewAllowContentAccess(true)
-// .webViewCookieEnabled(true)
-// .webViewDomStorageEnabled(true)
-// .webViewUserAgentString(USAGT)
-// .showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false)
-// .show("https://booktoki468.com/")
- true
- }
-
- arrayListOf(binding.mainList,binding.smsList,binding.infoList,binding.notiList).forEach {
- try {
- it.removeOnScrollListener(onScrChanged)
- } catch (e: Exception) {
- e.printStackTrace()
- }
- it.addOnScrollListener(onScrChanged)
- }
-
-
-
queryInfos()
- queryNotice()
- queryWeather()
- queryApps()
- setMusicFunction()
return binding.root
}
- fun isPackageInstalled( packageName : String, packageManager : PackageManager?) : Boolean{
- try {
- packageManager!!.getPackageInfo(packageName, 0);
- return true;
- } catch ( e : Exception) {
- return false;
- }
- }
-
- private fun queryApps() {
- WorkersDb.getRealm().apply {
- var newQ = query()
- newQ.sort(Pair("clickCount", Sort.DESCENDING),Pair("lastUseDate",Sort.DESCENDING)).limit(30).find()?.let {
- if(it.size > 0) {
- WorkersDb.getRealm().apply {
- var packageList = arrayListOf()
- writeBlocking {
- it.filter {
- var installed = isPackageInstalled(it.pkgName ?: "fffffffail", lActivity?.packageManager)
-// it.isInstalled = installed
- installed
- }.let { result ->
- packageList.addAll(copyFromRealm(result))
- binding.appsList.post { if (result.size > 0) {
- mAppsAdapter?.updateData(packageList)
- }}
- }
- }
- }
- }
- }
- }
- }
-
- fun setMusicFunction() {
- binding.currentMusic.setOnClickListener {
- lActivity?.apply {
- packageManager?.apply {
- startActivity(getLaunchIntentForPackage("com.google.android.apps.youtube.music"))
- }
- }
- }
-
- if(PrefBoolean.showNowPlaying.get(false)) {
- musicJob?.cancel()
- musicJob = CoroutineScope(Dispatchers.Default).launch {
- WorkersDb.getRealm().apply {
- query().find().asFlow()
- .collect { changes: ResultsChange ->
- binding.currentMusic.postDelayed({
- Blog.LOGE("changes.list >>> ${changes.list}")
- if (changes.list.size > 0) {
- changes.list.first()?.let {
- binding.currentMusic.visibility = View.VISIBLE
- binding.nextPlay.visibility = View.GONE
- binding.artist.text = it.artists
- binding.artist.isSelected = true
- binding.title.text = it.title
- binding.title.isSelected = true
- try {
- BitmapConverter.StringToBitmap(it.albumArt)?.let {
- binding.albumArt.setImageBitmap(it)
- }
- } catch (exception: java.lang.Exception) {
- // log error
- }
- }
- } else {
- binding.currentMusic.visibility = View.GONE
- binding.nextPlay.visibility = View.VISIBLE
- }
- }, 150L)
- }
- }
- }
- musicJob?.start()
- binding.nextBtn.setOnClickListener {
- val mAudioManager =
- requireContext().getSystemService(AUDIO_SERVICE) as AudioManager
-
- val eventtime: Long = SystemClock.uptimeMillis()
-
- val downEvent =
- KeyEvent(eventtime, eventtime, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_NEXT, 0)
- mAudioManager.dispatchMediaKeyEvent(downEvent)
-
- val upEvent =
- KeyEvent(eventtime, eventtime, KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_NEXT, 0)
- mAudioManager.dispatchMediaKeyEvent(upEvent)
- }
- binding.nextPlay.setOnClickListener {
- val mAudioManager =
- requireContext().getSystemService(AUDIO_SERVICE) as AudioManager
-
- val eventtime: Long = SystemClock.uptimeMillis()
-
- val downEvent =
- KeyEvent(eventtime, eventtime, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_PLAY, 0)
- mAudioManager.dispatchMediaKeyEvent(downEvent)
-
- val upEvent =
- KeyEvent(eventtime, eventtime, KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_PLAY, 0)
- mAudioManager.dispatchMediaKeyEvent(upEvent)
- }
- } else {
- binding.currentMusic.visibility = View.GONE
- binding.nextPlay.visibility = View.VISIBLE
- }
- }
- @SuppressLint("NotifyDataSetChanged")
- fun queryWeatherWithLoc() {
- WorkersDb.getRealm().apply {
- var latR = latitudeRange(
- BigDecimal.valueOf(LocationGetter.latitude).setScale(6, RoundingMode.HALF_UP)
- .toDouble(), 200
- )
- var lonR = longitudeRange(
- BigDecimal.valueOf(LocationGetter.latitude).setScale(6, RoundingMode.HALF_UP)
- .toDouble(),
- BigDecimal.valueOf(LocationGetter.longitude).setScale(6, RoundingMode.HALF_UP)
- .toDouble(),
- 200
- )
- query()
- .query(
- "lat >= $0 AND lat <= $1 AND lon >= $2 AND lon <= $3 AND time_epoch >= $4",
- latR.first(), latR.last(),
- lonR.first(), lonR.last(),
- (System.currentTimeMillis() / 1000L).toLong()
- ).also {
-// Blog.LOGE("re >>> ${it.description()}")
- }.find().let { hours ->
- Handler(Looper.getMainLooper()).post {
- weatherDressAdapter?.let {
- it.update(
- mutableListOf().apply {
- this.addAll(
-// it.filter(hours)
- copyFromRealm(hours)
- )
- }
- )
- it.notifyDataSetChanged()
- }
- weatherHourlyAdapter?.let {
- it.update(
- mutableListOf().apply {
- this.addAll(
-// it.filter(hours)
- copyFromRealm(hours)
- )
- }
- )
-// Blog.LOGE("hour ${hours}")
- it.notifyDataSetChanged()
- }
- mWeatherAdapter?.let {
- fun onclick() {
- requireContext().startActivity(Intent().apply {
- action = Intent.ACTION_VIEW
- setData(Uri.parse("https://www.accuweather.com/ko/search-locations?query=${LocationGetter.latitude},${LocationGetter.longitude}"))
- })
- }
- binding.weathers.weatherViewPager.setOnTouchListener { v, event ->
- onclick()
- true
- }
- binding.weathers.weatherViewPager.setOnClickListener { onclick() }
- binding.weathers.root.setOnClickListener { onclick() }
- binding.weathers.textLocation =
- if (hours.isNotEmpty()) WeatherInfoManager.getShowingInfo(hours.first()).textLocation else "도시 / 나라"
- it.notifyDataSetChanged()
- }
- }
- }
- }
- }
-
-
- // lateinit var weatherJob : Job
-// @SuppressLint("NotifyDataSetChanged")
- private fun queryWeather() {
- result = WorkersDb.getRealm().query().also {
-// Blog.LOGE("re >>> ${it.description()}") // 쿼리 로그
- }.find()
- weatherJob?.cancel()
- weatherJob = CoroutineScope(Dispatchers.Default).launch {
- result?.asFlow()?.collect { li ->
- //Blog.LOGE("queryWeather done. >>> ${li}")
- if (li.list.size > 0) {
- //Blog.LOGE("queryWeather done. >>> ${li.list.size}")
- queryWeatherWithLoc()
- }
- }
- }
- weatherJob?.start()
- }
-
-
- val onScrChanged = object : RecyclerView.OnScrollListener() {
- override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
- super.onScrollStateChanged(recyclerView, newState)
- commandHandler.removeCallbacks(hideListView)
- when (newState) {
- RecyclerView.SCROLL_STATE_IDLE -> {
- commandHandler.postDelayed(hideListView, hideListViewTime)
- }
-
- RecyclerView.SCROLL_STATE_DRAGGING -> {
- }
-
- RecyclerView.SCROLL_STATE_SETTLING -> {
- }
- }
- }
-
- override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
- super.onScrolled(recyclerView, dx, dy)
- commandHandler.removeCallbacks(hideListView)
- }
- }
-
- private fun queryNotice() {
- mNotificationResult = null
- clearJob(noticeJob)
- mNotificationResult = WorkersDb.getRealm().query().sort("postTime", Sort.DESCENDING).find()
- noticeJob = CoroutineScope(Dispatchers.Default).launch {
- mNotificationResult?.asFlow()?.collect { changes: ResultsChange ->
- commandHandler.removeCallbacks(hideListView)
- when (changes) {
- is UpdatedResults -> {
- WorkersDb.getRealm().apply {
- lastedNoti = copyFromRealm(changes.list)
- }
- commandHandler.removeCallbacks(notiUpdate)
- commandHandler.postDelayed(notiUpdate, UPDATE_DELAY)
- }
-
- else -> {
- }
- }
- }
- }
- noticeJob?.start()
- }
fun clearJob(job : Job?) {
try { job?.cancel() } catch (e: Exception) { e.printStackTrace() }
try { System.gc() } catch (e: Exception) { e.printStackTrace() }
}
+
fun beforeQuery() {
clearJob(infosJob)
mRssDataResult = null
@@ -558,23 +190,17 @@ internal class LauncherHome : Fragment() {
fun updateQuery(q: RealmQuery) {
mRssDataResult = q.sort("pubDate ", Sort.DESCENDING).limit(300).distinct("originPage", "title").find()
mRssDataResult?.asFlow()?.let { flow ->
-
infosJob = CoroutineScope(Dispatchers.IO).launch {
flow.collect { changes: ResultsChange ->
- commandHandler.removeCallbacks(hideListView)
commandHandler.removeCallbacks(infoUpdate)
WorkersDb.getRealm().apply {
lasted = copyFromRealm(changes.list)
}
commandHandler.postDelayed(infoUpdate, UPDATE_DELAY)
-
}
}
infosJob?.start()
}
-
-
-
}
fun queryVotes() {
@@ -606,31 +232,8 @@ internal class LauncherHome : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
-
- PrefBoolean.displayDateTime.get().letTrue {
- binding.time.visibility = View.VISIBLE
- }
-
-
- PrefBoolean.displayBattery.get().letTrue {
- binding.batteryProgress.visibility = View.VISIBLE
- }
-
- binding.batteryProgress.setOnTouchListener(SimpleFingerGestures(context = requireContext(), binding.batteryProgress, mFingerGestureListener))
- binding.root.setOnTouchListener(SimpleFingerGestures(context = requireContext(), binding.root, mFingerGestureListener))
- binding.functionLayer.setOnTouchListener(SimpleFingerGestures(context = requireContext(), binding.functionLayer, mFingerGestureListener))
- binding.time.setOnTouchListener(SimpleFingerGestures(context = requireContext(), binding.time, mFingerGestureListener))
-
Blog.LOGE("onViewCreated()")
- binding.summaryChoose.visibility = View.GONE
- (PrefBoolean.showCallHistory.get(false) || PrefBoolean.showSMSHistory.get(false) || PrefBoolean.showNotificationHistory.get(false) || PrefBoolean.showNewsHistory.get(false)).letTrue {
- binding.summaryChoose.visibility = View.VISIBLE
- binding.missedCalls.visibility = if (PrefBoolean.showCallHistory.get(false)) View.VISIBLE else View.GONE
- binding.recentSms.visibility = if (PrefBoolean.showSMSHistory.get(false)) View.VISIBLE else View.GONE
- binding.notice.visibility = if (PrefBoolean.showNotificationHistory.get(false)) View.VISIBLE else View.GONE
- binding.otherCheck.visibility = if (PrefBoolean.showNewsHistory.get(false)) View.VISIBLE else View.GONE
- }
fragManager.addOnBackStackChangedListener {
Blog.LOGE("addOnBackStackChangedListener()")
@@ -642,223 +245,14 @@ internal class LauncherHome : Fragment() {
false
}
}
-
- var checkListner = object : View.OnClickListener {
- override fun onClick(v: View?) {
- commandHandler.removeCallbacks(hideListView)
- var views = arrayListOf(binding.mainList, binding.smsList, binding.infoList, binding.notiList,binding.appsList)
- var chechboxs = arrayListOf(binding.missedCalls, binding.recentSms, binding.otherCheck, binding.notice, binding.favApps)
- chechboxs.remove(v)
- when (v) {
- binding.missedCalls -> {
- binding.missedCalls.isSelected = !binding.missedCalls.isSelected
- if (binding.missedCalls.isSelected) {
- views.remove(binding.mainList)
- binding.mainList.visibility = View.VISIBLE
- }
- }
-
- binding.recentSms -> {
- binding.recentSms.isSelected = !binding.recentSms.isSelected
- if (binding.recentSms.isSelected) {
- views.remove(binding.smsList)
- binding.smsList.visibility = View.VISIBLE
- }
- }
-
- binding.otherCheck -> {
- if (binding.otherCheck.isSelected) {
- if (rssStateVote()) {
- queryInfos()
- } else {
- binding.otherCheck.isSelected = false
- }
- } else {
- queryInfos()
- binding.otherCheck.isSelected = true
- views.remove(binding.infoList)
- binding.infoList.scrollToPosition(0)
- binding.infoList.visibility = View.VISIBLE
- }
- }
-
- binding.notice -> {
- if (binding.notice.isSelected) {
- binding.notice.isSelected = false
- } else {
- queryNotice()
- binding.notice.isSelected = true
- views.remove(binding.notiList)
- binding.notiList.visibility = View.VISIBLE
- }
- }
- binding.favApps -> {
- if (binding.favApps.isSelected) {
- binding.favApps.isSelected = false
- } else {
- binding.favApps.isSelected = true
- views.remove(binding.appsList)
- binding.appsList.visibility = View.VISIBLE
- }
- }
- }
- chechboxs.forEach { it.isSelected = false }
- views.forEach { it.visibility = View.GONE }
- chooseAdpater()
- }
- }
-
- binding.otherCheck.setOnClickListener(checkListner)
- binding.recentSms.setOnClickListener(checkListner)
- binding.missedCalls.setOnClickListener(checkListner)
- binding.notice.setOnClickListener(checkListner)
- binding.favApps.setOnClickListener(checkListner)
- binding.otherCheck.setOnLongClickListener {
- queryInfos()
- true
- }
enableSwipeToDeleteAndUndo()
}
- fun searchData() {
- val builder: AlertDialog.Builder = AlertDialog.Builder(requireContext())
- builder.setTitle("Command Line")
- val viewInflated: View = LayoutInflater.from(context)
- .inflate(R.layout.search_layout, view as ViewGroup?, false)
- val input = viewInflated.findViewById(R.id.input) as EditText
- val categoryz =
- viewInflated.findViewById(R.id.categoryz) as TableRadioGroup
- categoryz.setMaxColumns(3)
- categoryz.setMaxRows(8)
- categoryz.setOnCheckedChangeListener(object : TableRadioGroup.OnCheckedChangeListener {
- override fun onCheckedChanged(group: TableRadioGroup?, checkedId: Int) {
-
- }
- })
- var idx = 0
- RssDataType.values().reversed().toList().chunked(3).forEach {
- var tb = TableRow(requireContext())
- it.forEach { c ->
- if (c.equals(RssDataType.NO_DATA) == false) {
- tb.addView(
- CheckBox(requireContext()).apply {
- this.tag = c.name
- this.text = c.name
- }
- )
- }
- }
- categoryz.addView(tb)
- }
-
- builder.setView(viewInflated)
- builder.setPositiveButton(android.R.string.ok,
- DialogInterface.OnClickListener { dialog, which ->
- dialog.dismiss()
- var category = arrayListOf()
- categoryz.children.forEach {
- if (it is TableRow) {
- it.children.forEach {
- if (it is CheckBox && it.isChecked) {
- (it.tag as? String)?.let { category.add(it) }
- }
- }
- }
- }
- queryInfos(keyword = input.text.toString(), category, false)
- })
- builder.setNegativeButton(android.R.string.cancel,
- DialogInterface.OnClickListener { dialog, which -> dialog.cancel() })
- builder.show()
- }
-
-
- fun showAl() {
- binding.alcholKatalkT.visibility = View.VISIBLE
- binding.alcholKatalkT.setOnClickListener {
- openSearchApps(
- "kakaot://taxi?dest_lat=${URLEncoder.encode("37.467696")}&dest_lng=${
- URLEncoder.encode(
- "127.101063"
- )
- }", "com.kakao.taxi"
- )
- }
-
- }
-
- fun openSearchApps(schemeString: String, pakage: String? = null) {
- val gmmIntentUri = Uri.parse(schemeString)
- val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
- pakage?.let {
- mapIntent.setPackage(pakage)
- }
- startActivity(mapIntent)
- }
-
- fun hideAl() {
- binding.alcholKatalkT.visibility = View.GONE
- binding.alcholKatalkT.setOnClickListener {
-
- }
- }
-
fun chooseAdpater() {
- commandHandler.removeCallbacks(hideListView)
- var tabs = arrayOf(binding.missedCalls,binding.recentSms,binding.otherCheck,binding.notice,binding.favApps)
- fun unsel(view: View) {
- tabs.filter {
- it.equals(view) == false
- }.forEach { it.isSelected = false }
- }
- binding.mainList.visibility = View.INVISIBLE
- binding.smsList.visibility = View.INVISIBLE
- binding.infoList.visibility = View.INVISIBLE
- binding.notiList.visibility = View.INVISIBLE
-
- var dateParam = beforeDay(30).toString()
- if (binding.missedCalls.isSelected) {
- WorkersDb.getRealm().apply {
- val result = query().query("callDayTime >= $0", dateParam)
- .sort("callDayTime", Sort.DESCENDING).find()
- val list = copyFromRealm(result)
- binding.missedCalls.text = "통화 목록 [${list.size}]"
- binding.mainList.visibility = View.VISIBLE
- mRecentCallsAdapter.updateData(list)
- }
- } else if (binding.recentSms.isSelected) {
- WorkersDb.getRealm().apply {
- val result = query().query("rcvDate >= $0 OR pstDate >= $0 ", dateParam)
- .sort("rcvDate", Sort.DESCENDING).find()
- if (result.size > 0) {
- try {
- binding.recentSms.text = "문자 내역 [${result.size}]"
- binding.smsList.visibility = View.VISIBLE
- val list = copyFromRealm(result)
- mSmsLogsAdapter.updateData(list)
-
- } catch (e: Exception) {
-
- }
- }
- }
- } else if (binding.otherCheck.isSelected) {
- unsel(binding.otherCheck)
- binding.infoList.visibility = View.VISIBLE
-// binding.otherCheck.text = "글타래 [${lasted?.size ?: "-"}]"
- lasted?.let { mRssAdapter.updateData(it) }
- } else if (binding.notice.isSelected) {
- unsel(binding.notice)
- binding.notiList.visibility = View.VISIBLE
-// binding.notice.text = "알림 [${lastedNoti?.size ?: "-"}]"
- lastedNoti?.let { mNotiAdapter.updateData(it) }
- } else if (binding.favApps.isSelected) {
- unsel(binding.favApps)
- binding.appsList.visibility = View.VISIBLE
- }
- commandHandler.postDelayed(hideListView, hideListViewTime)
+ binding.infoList.visibility = View.VISIBLE
+ lasted?.let { mRssAdapter.updateData(it) }
}
private fun enableSwipeToDeleteAndUndo() {
@@ -912,413 +306,14 @@ internal class LauncherHome : Fragment() {
override fun onResume() {
super.onResume()
-// BLog.LOGE("${this} ::::: onResume >>>> ")
if (shouldResume) {
- /* register battery changes */
- requireContext().registerReceiver(
- batteryReceiver,
- IntentFilter(Intent.ACTION_BATTERY_CHANGED)
- )
- /* time and date */
-// binding.time.textLocale = Locale.US
-// binding.date.textLocale = Locale.US
-// if (DateFormat.is24HourFormat(requireContext())) {
-// binding.time.format24Hour = timeFormat
-// binding.date.format24Hour = "yyyy년 M월 W주차, dd일 E요일"
-// } else {
-// binding.time.format12Hour = timeFormat
-// binding.date.format12Hour = dateFormat
-// }
- /* show weather */
-// WeatherExecutor(settingsPrefs).generateWeatherString(binding.weather)
}
-// binding.root.visibility = View.VISIBLE
}
-
override fun onPause() {
super.onPause()
- /* unregister battery changes */
- if (shouldResume) requireContext().unregisterReceiver(batteryReceiver)
-// binding.root.visibility = View.GONE
}
-
-
- var mFingerGestureListener = object : SimpleFingerGestures.OnFingerGestureListener {
- override fun onSwipeUp(
- targetView: View,
- fingers: Int,
- gestureDuration: Long,
- gestureDistance: Double
- ): Boolean {
- when (fingers) {
- 4 -> {
- lActivity!!.startActivity(Intent(requireContext(), Behavior::class.java))
- }
-
- 3 -> QuickAccess().show(fragManager, BOTTOM_SHEET_TAG)
- 2 -> {
- var startIntene = Intent(Intent.ACTION_MAIN)
- startIntene.setComponent(
- ComponentName(
- "com.mime.dualscreenview",
- "com.mime.dualscreenview.activity.Intro"
- )
- )
- startActivity(startIntene)
- }
- 1->{
- lActivity?.switchAppDrawer()
- }
- else -> {}
- }
- return false
- }
-
- override fun onSwipeDown(
- targetView: View,
- fingers: Int,
- gestureDuration: Long,
- gestureDistance: Double
- ): Boolean {
- when (fingers) {
- 2 ->
- if (targetView.equals(binding.batteryProgress)) {
- expandNotificationPanel(requireContext())
- } else {
- expandNotificationPanel(requireContext())
- }
-
- 4 -> {
- var startIntene = Intent(Intent.ACTION_MAIN)
- startIntene.setComponent(
- ComponentName(
- "com.samsung.android.app.interpreter",
- "com.samsung.android.app.interpreter.interpretation.view.InterpretationActivity"
- )
- )
- startActivity(startIntene)
- }
-
- 3 -> {
- lActivity!!.startActivity(
- Intent(
- requireContext(),
- SettingsActivity::class.java
- )
- )
- }
-
- else -> {}
- }
- return false
- }
-
- override fun onSwipeLeft(
- targetView: View,
- fingers: Int,
- gestureDuration: Long,
- gestureDistance: Double
- ): Boolean {
-// if (targetView.equals(binding.time)) {
-// val mClockIntent = Intent(AlarmClock.ACTION_SHOW_ALARMS)
-// mClockIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
-// startActivity(mClockIntent)
-// }
-
- Blog.LOGE("onSwipeLeft targetView. >>>> ${targetView} && ${targetView.equals(binding.functionLayer)}")
- if(targetView.equals(binding.functionLayer)){
- targetView?.performHapticFeedback(HapticFeedbackConstants.CONFIRM)
- when(fingers) {
- 1->lActivity?.switchAppDrawer()
- 2-> {
-
- }
- else ->{}
- }
- } else if (targetView.equals(binding.time) && fingers == 2) {
- val mClockIntent = Intent(AlarmClock.ACTION_SHOW_ALARMS)
- mClockIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
- startActivity(mClockIntent)
- }
- return false
- }
-
- override fun onSwipeRight(
- targetView: View,
- fingers: Int,
- gestureDuration: Long,
- gestureDistance: Double
- ): Boolean {
- if(targetView.equals(binding.functionLayer)){
- targetView?.performHapticFeedback(HapticFeedbackConstants.CONFIRM)
- when(fingers) {
- 1-> {
- lActivity?.switchFeeds()
- return true
- }
- //
- else ->{}
- }
- } else if (targetView.equals(binding.time) && fingers == 2) {
- val intent = Intent(Intent.ACTION_MAIN)
- intent.addCategory(Intent.CATEGORY_APP_CALENDAR)
- startActivity(intent)
- }
- return false
- }
-
- override fun onPinch(
- targetView: View,
- fingers: Int,
- gestureDuration: Long,
- gestureDistance: Double
- ): Boolean {
- Blog.LOGE("Maybe GA PINCH is Like Zoom out")
- return false
- }
-
- override fun onUnpinch(
- targetView: View,
- fingers: Int,
- gestureDuration: Long,
- gestureDistance: Double
- ): Boolean {
- Blog.LOGE("Maybe GA UN PINCH is Like Zoom In")
- return false
- }
-
- override fun onDoubleTap(targetView: View, fingers: Int): Boolean {
- targetView?.performHapticFeedback(HapticFeedbackConstants.CONFIRM)
- when (fingers) {
- 1 -> lockMethod(settingsPrefs.getInt(KEY_LOCK_METHOD, 0), requireContext(), binding.functionLayer)
- else -> {
-
- }
- }
- return false
- }
-
- override fun onLongPress(targetView: View, fingers: Int): Boolean {
- if (targetView?.equals(binding.batteryProgress) == true) {
- lActivity!!.startActivity(Intent(requireContext(), SettingsActivity::class.java))
- } else if (targetView?.equals(binding.mainList) == true) {
-// when (settingsPrefs.getBoolean(KEY_TODO_LOCK, false)) {
-// false -> launchTodoManager()
-// /* show authentication screen if lock is on */
-// true -> {
-// if (canAuthenticate(requireContext())) {
-// val biometricPrompt =
-// BiometricPrompt(lActivity!!, authenticationCallback)
-// try {
-// biometricPrompt.authenticate(
-// biometricPromptInfo(
-// lActivity!!.getString(
-// R.string.todo_manager
-// )
-// )
-// )
-// } catch (exception: Exception) {
-// exception.printStackTrace()
-// }
-// }
-// }
-// }
- } else if (targetView?.equals(binding.functionLayer) == true) {
- targetView?.performHapticFeedback(HapticFeedbackConstants.CONFIRM)
- if(binding.otherCheck.isSelected && rssStateVote()) {
- queryInfos()
- } else {
- binding.otherCheck.isSelected = true
- queryVotes()
- }
- return true
- }
- return false
- }
-
- override fun onClick(targetView: View, fingers: Int): Boolean {
-// BLog.LOGE("onClick ${view} , fingers ${fingers}")
- targetView.performHapticFeedback(HapticFeedbackConstants.CONFIRM)
- when (fingers) {
- 1 -> {
- if (targetView.equals(binding.batteryProgress) == true) {
- startActivity(Intent(android.provider.Settings.ACTION_SETTINGS))
- }else if(targetView.equals(binding.functionLayer)) {
- if (binding.otherCheck.isSelected) {
- searchData()
- }
-// else if (binding.otherCheck.isSelected) {
-// searchData()
-// }
-// else if (binding.otherCheck.isSelected) {
-// searchData()
-// }
-// else if (binding.otherCheck.isSelected) {
-// searchData()
-// }
-// else if (binding.otherCheck.isSelected) {
-// searchData()
-// }
- else {
-// QuickAccess().show(fragManager, BOTTOM_SHEET_TAG)
- }
- }
- }
-
- 2 -> {
- lockMethod(
- settingsPrefs.getInt(KEY_LOCK_METHOD, 0),
- requireContext(),
- binding.functionLayer
- )
- }
-
- else -> {
-
- }
- }
-
- return true
- }
-
- }
-
-
- fun jsonObjLog(pkey: String, key: String, jsonObject: JSONObject) {
- if (jsonObject.has(key) == true && jsonObject.get(key) is String) {
- Blog.LOGE("jsonObjLog $pkey String in $key >> ${jsonObject.getString(key)}")
- } else if (jsonObject.has(key) == true && jsonObject.get(key) is JSONObject) {
- var obj = jsonObject.getJSONObject(key)
- Blog.LOGE("jsonObjLog $pkey JSONObject in $key >> ${obj}")
- obj?.keys()?.forEach {
-// jsonObjLog(key,it, obj)
- }
- } else if (jsonObject.has(key) == true && jsonObject.get(key) is JSONArray) {
- Blog.LOGE("jsonObjLog $pkey JSONArray in $key >> ${jsonObject.getJSONArray(key)}")
- var array = jsonObject.getJSONArray(key)
- for (i in 0..<(array?.length() ?: 0)) {
- if (array?.get(i) is String) {
-
- } else if (array?.get(i) is JSONObject) {
- var child = array.getJSONObject(i)
- child?.keys()?.forEach {
-// jsonObjLog(key, it, child)
- }
- } else if (array?.get(i) is JSONArray) {
- Blog.LOGE("jsonObjLog $pkey JSONArray in $key >> ${array.getJSONArray(i)}")
- }
- }
- } else {
- Blog.LOGE(
- "jsonObjLog $pkey else in $key >> ${
- if (jsonObject.has(key) == true) (jsonObject.get(
- key
- )) else ("")
- }"
- )
- }
- }
-
-
- /* gestures on root view */
- @SuppressLint("ClickableViewAccessibility")
- private fun rootViewGestures() {
- binding.root.setOnTouchListener(
- SimpleFingerGestures(
- context = requireContext(),
- binding.root,
- mFingerGestureListener
- )
- )
- }
-
-
-
- /* gestures on to-do area */
- @SuppressLint("ClickableViewAccessibility")
- private fun todosGestures() {
- binding.mainList.setOnTouchListener(
- SimpleFingerGestures(
- context = requireContext(),
- binding.mainList,
- mFingerGestureListener
- )
- )
- }
-
-
-
- /* authentication callback for TodoManager lock */
- private val authenticationCallback = object : BiometricPrompt.AuthenticationCallback() {
- override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
- launchTodoManager()
- }
-
- override fun onAuthenticationError(errorCode: Int, errString: CharSequence) {
- Toast.makeText(
- requireContext(),
- lActivity!!.getString(R.string.authentication_error),
- Toast.LENGTH_SHORT
- ).show()
- }
-
- override fun onAuthenticationFailed() {
- Toast.makeText(
- requireContext(),
- lActivity!!.getString(R.string.authentication_failed),
- Toast.LENGTH_SHORT
- ).show()
- }
- }
-
- /* launch TodoManager fragment */
- private fun launchTodoManager() {
-// fragManager.beginTransaction().replace(R.id.mainFragmentsContainer, TodoManager())
-// .addToBackStack("").commit()
- }
-
-
- /* get time format string */
- private val timeFormat: String
- get() {
-// when (settingsPrefs.getInt(KEY_TIME_FORMAT, 0)) {
-// 0 -> return if (DateFormat.is24HourFormat(requireContext())) {
-// "kk:mm"
-// } else {
-// "HH:mm a"
-// }
-// 1 -> return "HH:mm a"
-// 2 -> return "kk:mm"
-// }
- return "a HH : mm"
- }
-
- /* get date number suffix */
- private val dateNumberSuffix: String
- get() {
- return when (Calendar.getInstance()[Calendar.DAY_OF_MONTH]) {
- 1, 21, 31 -> "ˢᵗ"
- 2, 22 -> "ⁿᵈ"
- 3, 23 -> "ʳᵈ"
- else -> "ᵗʰ"
- }
- }
-
- /* get date format string */
- private val dateFormat: String
- get() {
-// settingsPrefs.getString(KEY_DATE_FORMAT, DEFAULT_DATE_FORMAT).let {
-// return if (it!!.contains("x")) {
-// it.replace("x", dateNumberSuffix)
-// } else {
-// it
-// }
-// }
- return "yyyy년 M월 W주차, dd일 E요일"
- }
-
}
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/LauncherHome_old.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/LauncherHome_old.kt
new file mode 100644
index 00000000..52532362
--- /dev/null
+++ b/app/src/main/kotlin/bums/lunatic/launcher/home/LauncherHome_old.kt
@@ -0,0 +1,1328 @@
+/*
+ * 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 .
+ */
+
+package bums.lunatic.launcher.home
+
+import android.annotation.SuppressLint
+import android.content.ComponentName
+import android.content.Context.AUDIO_SERVICE
+import android.content.DialogInterface
+import android.content.Intent
+import android.content.IntentFilter
+import android.content.SharedPreferences
+import android.content.pm.PackageManager
+import android.media.AudioManager
+import android.net.Uri
+import android.os.Bundle
+import android.os.Handler
+import android.os.Looper
+import android.os.SystemClock
+import android.provider.AlarmClock
+import android.provider.Settings
+import android.view.HapticFeedbackConstants
+import android.view.KeyEvent
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.webkit.WebSettings.LOAD_NO_CACHE
+import android.webkit.WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
+import android.widget.CheckBox
+import android.widget.EditText
+import android.widget.TableRow
+import android.widget.Toast
+import androidx.annotation.NonNull
+import androidx.appcompat.app.AlertDialog
+import androidx.biometric.BiometricPrompt
+import androidx.core.view.children
+import androidx.fragment.app.Fragment
+import androidx.fragment.app.FragmentManager
+import androidx.recyclerview.widget.DividerItemDecoration
+import androidx.recyclerview.widget.ItemTouchHelper
+import androidx.recyclerview.widget.RecyclerView
+import androidx.viewpager2.widget.ViewPager2
+import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
+import bums.lunatic.launcher.R
+import bums.lunatic.launcher.apps.AppsAdapter
+import bums.lunatic.launcher.behavior.Behavior
+import bums.lunatic.launcher.common.letTrue
+import bums.lunatic.launcher.databinding.LauncherHomeBinding
+import bums.lunatic.launcher.databinding.LauncherHomeOldBinding
+import bums.lunatic.launcher.helpers.Constants.Companion.BOTTOM_SHEET_TAG
+import bums.lunatic.launcher.helpers.Constants.Companion.KEY_LOCK_METHOD
+import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS
+import bums.lunatic.launcher.helpers.PrefBoolean
+import bums.lunatic.launcher.helpers.UniUtils.Companion.expandNotificationPanel
+import bums.lunatic.launcher.helpers.UniUtils.Companion.lockMethod
+import bums.lunatic.launcher.home.adapters.NotificationItemAdapter
+import bums.lunatic.launcher.home.adapters.RecentCallsAdapter
+import bums.lunatic.launcher.home.adapters.RssItemAdapter
+import bums.lunatic.launcher.home.adapters.SmsLogsAdapter
+import bums.lunatic.launcher.home.adapters.SwipeToDeleteCallback
+import bums.lunatic.launcher.home.adapters.WeatherAdapter
+import bums.lunatic.launcher.home.adapters.WeatherDressAdatper
+import bums.lunatic.launcher.home.adapters.WeatherHourlyAdapter
+import bums.lunatic.launcher.model.AppInfo
+import bums.lunatic.launcher.model.CurrentPlayItem
+import bums.lunatic.launcher.model.Hour
+import bums.lunatic.launcher.model.NotificationItem
+import bums.lunatic.launcher.model.RssData
+import bums.lunatic.launcher.model.RssDataInterface
+import bums.lunatic.launcher.model.RssDataType
+import bums.lunatic.launcher.model.WeatherForcast
+import bums.lunatic.launcher.model.WeatherInfoManager
+import bums.lunatic.launcher.qaccess.QuickAccess
+import bums.lunatic.launcher.settings.SettingsActivity
+import bums.lunatic.launcher.utils.Blog
+import bums.lunatic.launcher.utils.BitmapConverter
+import bums.lunatic.launcher.utils.SimpleFingerGestures
+import bums.lunatic.launcher.utils.USAGT
+import bums.lunatic.launcher.utils.beforeDay
+import bums.lunatic.launcher.utils.beforeOneDay
+import bums.lunatic.launcher.view.TableRadioGroup
+import bums.lunatic.launcher.workers.LocationGetter
+import bums.lunatic.launcher.workers.RecentCall
+import bums.lunatic.launcher.workers.RecentSms
+import bums.lunatic.launcher.workers.WorkersDb
+import bums.lunatic.launcher.workers.latitudeRange
+import bums.lunatic.launcher.workers.longitudeRange
+import io.realm.kotlin.UpdatePolicy
+import io.realm.kotlin.ext.query
+import io.realm.kotlin.notifications.InitialResults
+import io.realm.kotlin.notifications.ResultsChange
+import io.realm.kotlin.notifications.UpdatedResults
+import io.realm.kotlin.query.RealmQuery
+import io.realm.kotlin.query.RealmResults
+import io.realm.kotlin.query.Sort
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.Job
+import kotlinx.coroutines.flow.cancellable
+import kotlinx.coroutines.flow.collect
+import kotlinx.coroutines.launch
+import okhttp3.Dns
+import org.json.JSONArray
+import org.json.JSONObject
+import java.math.BigDecimal
+import java.math.RoundingMode
+import java.net.URLEncoder
+import java.util.Calendar
+import kotlin.jvm.java
+
+
+internal class LauncherHome_old : Fragment() {
+
+ lateinit var binding: LauncherHomeOldBinding
+ private lateinit var fragManager: FragmentManager
+ private lateinit var settingsPrefs: SharedPreferences
+ private lateinit var batteryReceiver: BatteryReceiver
+ private var shouldResume = true
+
+ companion object {
+ var home: LauncherHome_old? = null
+ var lastedFinishedPageUrl: String = ""
+ var listTags = arrayListOf()
+ }
+
+ val UPDATE_DELAY = 5L
+ val commandHandler = Handler(Looper.getMainLooper())
+
+ val infoUpdate = Runnable { chooseAdpater() }
+ val notiUpdate = Runnable { chooseAdpater() }
+
+ var weatherJob: Job? = null
+ var result: RealmResults? = null
+ val hideListViewTime = 1000L * 60L * 15L
+ val hideListView = {
+// binding.notiList.visibility = View.GONE
+// binding.mainList.visibility = View.GONE
+// binding.infoList.visibility = View.GONE
+// binding.smsList.visibility = View.GONE
+// binding.otherCheck.isSelected = false
+// binding.recentSms.isSelected = false
+// binding.missedCalls.isSelected = false
+// binding.notice.isSelected = false
+ }
+
+ val nomoreShowCount = 5
+ fun rssStateVote() = (lasted?.filter { it.vote == true }?.size ?: -1) == (lasted?.size ?: 0)
+
+ var lasted: List? = null
+ var lastedNoti: List? = null
+ var infosJob: Job? = null
+ var noticeJob: Job? = null
+
+ lateinit var mRecentCallsAdapter: RecentCallsAdapter
+ lateinit var mSmsLogsAdapter: SmsLogsAdapter
+ lateinit var mRssAdapter: RssItemAdapter
+ lateinit var mNotiAdapter: NotificationItemAdapter
+ lateinit var mAppsAdapter: AppsAdapter
+ var mWeatherAdapter: WeatherAdapter? = null
+ var weatherDressAdapter: WeatherDressAdatper? = null
+ var weatherHourlyAdapter: WeatherHourlyAdapter? = null
+ var mRssDataResult: RealmResults? = null
+ var mNotificationResult: RealmResults? = null
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ home = this
+ }
+
+ var musicJob: Job? = null
+ override fun onCreateView(
+ inflater: LayoutInflater,
+ container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ binding = LauncherHomeOldBinding.inflate(inflater, container, false)
+ fragManager = lActivity!!.supportFragmentManager
+ settingsPrefs = requireContext().getSharedPreferences(PREFS_SETTINGS, 0)
+ batteryReceiver = BatteryReceiver(binding.batteryProgress)
+ mRecentCallsAdapter = RecentCallsAdapter(arrayListOf(), requireContext())
+ mSmsLogsAdapter = SmsLogsAdapter(arrayListOf(), requireContext())
+ mNotiAdapter = NotificationItemAdapter(requireContext())
+ mAppsAdapter = AppsAdapter(requireContext().packageManager , fragManager, null)
+ mRssAdapter = RssItemAdapter(requireContext())
+
+ weatherDressAdapter = WeatherDressAdatper(arrayListOf())
+ weatherHourlyAdapter = WeatherHourlyAdapter(arrayListOf())
+
+
+ var weatherPages = arrayListOf()
+ var weatherAdapter = arrayListOf?>()
+ (PrefBoolean.weatherDress.get(false) || PrefBoolean.weatherState.get(false)).letTrue {
+ PrefBoolean.weatherDress.get(false).letTrue { weatherPages.add(R.layout.hourly_weather); weatherAdapter.add(weatherDressAdapter!!) }
+ PrefBoolean.weatherState.get(false).letTrue { weatherPages.add(R.layout.recommended_hourly_dress); weatherAdapter.add(weatherHourlyAdapter!!) }
+ binding.weathers.root.visibility = View.VISIBLE
+ mWeatherAdapter = WeatherAdapter(weatherPages, adatpers = weatherAdapter, binding.weathers)
+ binding.weathers.weatherViewPager.offscreenPageLimit = 2
+ }
+
+ val decoration = DividerItemDecoration(requireContext(), DividerItemDecoration.VERTICAL)
+
+ binding.notiList.addItemDecoration(decoration)
+ binding.infoList.addItemDecoration(decoration)
+
+ binding.smsList.visibility = View.GONE
+ binding.infoList.visibility = View.GONE
+
+ binding.weathers.weatherViewPager.orientation = ViewPager2.ORIENTATION_VERTICAL
+
+ binding.mainList.adapter = mRecentCallsAdapter
+ binding.smsList.adapter = mSmsLogsAdapter
+ binding.infoList.adapter = mRssAdapter
+ binding.notiList.adapter = mNotiAdapter
+ binding.appsList.adapter = mAppsAdapter
+ binding.weathers.weatherViewPager.adapter = mWeatherAdapter
+ binding.weathers.weatherViewPager.registerOnPageChangeCallback(object :
+ ViewPager2.OnPageChangeCallback() {
+ override fun onPageSelected(position: Int) {
+ super.onPageSelected(position)
+ // 페이지가 변경될 때 호출됨
+ mWeatherAdapter?.syncScroll(position)
+
+ }
+
+ })
+
+ binding.favApps.setOnLongClickListener {
+ RssViewBuilder(lActivity!!)
+ .setRssId("https://jav.guru")
+ .webViewDomStorageEnabled(true)
+ .webViewJavaScriptEnabled(true)
+ .webViewUserAgentAppend(false)
+ .webViewAllowContentAccess(true)
+ .webViewCookieEnabled(true)
+ .webViewCacheMode(LOAD_NO_CACHE)
+ .webViewUserAgentString(USAGT)
+ .webViewMixedContentMode(MIXED_CONTENT_ALWAYS_ALLOW)
+ .showIconClose(true)
+ .showIconBack(false)
+ .showProgressBar(true)
+ .backPressToClose(false)
+ .webViewCookieEnabled(true)
+ .show("https://jav.guru")
+ true
+ }
+
+ binding.missedCalls.setOnLongClickListener {
+// lActivity?.startActivity(Intent(lActivity, PhotoFilter::class.java))
+// RssViewBuilder(lActivity!!)
+// .setRssId("https://booktoki468.com/")
+// .webViewMixedContentMode(MIXED_CONTENT_ALWAYS_ALLOW)
+// .webViewCacheMode(LOAD_NO_CACHE)
+// .webViewJavaScriptEnabled(true)
+// .webViewUserAgentAppend(false)
+// .webViewAllowContentAccess(true)
+// .webViewCookieEnabled(true)
+// .webViewDomStorageEnabled(true)
+// .webViewUserAgentString(USAGT)
+// .showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false)
+// .show("https://booktoki468.com/")
+ true
+ }
+
+ arrayListOf(binding.mainList,binding.smsList,binding.infoList,binding.notiList).forEach {
+ try {
+ it.removeOnScrollListener(onScrChanged)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ it.addOnScrollListener(onScrChanged)
+ }
+
+
+
+ queryInfos()
+ queryNotice()
+ queryWeather()
+ queryApps()
+ setMusicFunction()
+ return binding.root
+ }
+
+ fun isPackageInstalled( packageName : String, packageManager : PackageManager?) : Boolean{
+ try {
+ packageManager!!.getPackageInfo(packageName, 0);
+ return true;
+ } catch ( e : Exception) {
+ return false;
+ }
+ }
+
+ private fun queryApps() {
+ WorkersDb.getRealm().apply {
+ var newQ = query()
+ newQ.sort(Pair("clickCount", Sort.DESCENDING),Pair("lastUseDate",Sort.DESCENDING)).limit(30).find()?.let {
+ if(it.size > 0) {
+ WorkersDb.getRealm().apply {
+ var packageList = arrayListOf()
+ writeBlocking {
+ it.filter {
+ var installed = isPackageInstalled(it.pkgName ?: "fffffffail", lActivity?.packageManager)
+// it.isInstalled = installed
+ installed
+ }.let { result ->
+ packageList.addAll(copyFromRealm(result))
+ binding.appsList.post { if (result.size > 0) {
+ mAppsAdapter?.updateData(packageList)
+ }}
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ fun setMusicFunction() {
+ binding.currentMusic.setOnClickListener {
+ lActivity?.apply {
+ packageManager?.apply {
+ startActivity(getLaunchIntentForPackage("com.google.android.apps.youtube.music"))
+ }
+ }
+ }
+
+ if(PrefBoolean.showNowPlaying.get(false)) {
+ musicJob?.cancel()
+ musicJob = CoroutineScope(Dispatchers.Default).launch {
+ WorkersDb.getRealm().apply {
+ query().find().asFlow()
+ .collect { changes: ResultsChange ->
+ binding.currentMusic.postDelayed({
+ Blog.LOGE("changes.list >>> ${changes.list}")
+ if (changes.list.size > 0) {
+ changes.list.first()?.let {
+ binding.currentMusic.visibility = View.VISIBLE
+ binding.nextPlay.visibility = View.GONE
+ binding.artist.text = it.artists
+ binding.artist.isSelected = true
+ binding.title.text = it.title
+ binding.title.isSelected = true
+ try {
+ BitmapConverter.StringToBitmap(it.albumArt)?.let {
+ binding.albumArt.setImageBitmap(it)
+ }
+ } catch (exception: java.lang.Exception) {
+ // log error
+ }
+ }
+ } else {
+ binding.currentMusic.visibility = View.GONE
+ binding.nextPlay.visibility = View.VISIBLE
+ }
+ }, 150L)
+ }
+ }
+ }
+ musicJob?.start()
+ binding.nextBtn.setOnClickListener {
+ val mAudioManager =
+ requireContext().getSystemService(AUDIO_SERVICE) as AudioManager
+
+ val eventtime: Long = SystemClock.uptimeMillis()
+
+ val downEvent =
+ KeyEvent(eventtime, eventtime, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_NEXT, 0)
+ mAudioManager.dispatchMediaKeyEvent(downEvent)
+
+ val upEvent =
+ KeyEvent(eventtime, eventtime, KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_NEXT, 0)
+ mAudioManager.dispatchMediaKeyEvent(upEvent)
+ }
+ binding.nextPlay.setOnClickListener {
+ val mAudioManager =
+ requireContext().getSystemService(AUDIO_SERVICE) as AudioManager
+
+ val eventtime: Long = SystemClock.uptimeMillis()
+
+ val downEvent =
+ KeyEvent(eventtime, eventtime, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_PLAY, 0)
+ mAudioManager.dispatchMediaKeyEvent(downEvent)
+
+ val upEvent =
+ KeyEvent(eventtime, eventtime, KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_PLAY, 0)
+ mAudioManager.dispatchMediaKeyEvent(upEvent)
+ }
+ } else {
+ binding.currentMusic.visibility = View.GONE
+ binding.nextPlay.visibility = View.VISIBLE
+ }
+ }
+ @SuppressLint("NotifyDataSetChanged")
+ fun queryWeatherWithLoc() {
+ WorkersDb.getRealm().apply {
+ var latR = latitudeRange(
+ BigDecimal.valueOf(LocationGetter.latitude).setScale(6, RoundingMode.HALF_UP)
+ .toDouble(), 200
+ )
+ var lonR = longitudeRange(
+ BigDecimal.valueOf(LocationGetter.latitude).setScale(6, RoundingMode.HALF_UP)
+ .toDouble(),
+ BigDecimal.valueOf(LocationGetter.longitude).setScale(6, RoundingMode.HALF_UP)
+ .toDouble(),
+ 200
+ )
+ query()
+ .query(
+ "lat >= $0 AND lat <= $1 AND lon >= $2 AND lon <= $3 AND time_epoch >= $4",
+ latR.first(), latR.last(),
+ lonR.first(), lonR.last(),
+ (System.currentTimeMillis() / 1000L).toLong()
+ ).also {
+// Blog.LOGE("re >>> ${it.description()}")
+ }.find().let { hours ->
+ Handler(Looper.getMainLooper()).post {
+ weatherDressAdapter?.let {
+ it.update(
+ mutableListOf().apply {
+ this.addAll(
+// it.filter(hours)
+ copyFromRealm(hours)
+ )
+ }
+ )
+ it.notifyDataSetChanged()
+ }
+ weatherHourlyAdapter?.let {
+ it.update(
+ mutableListOf().apply {
+ this.addAll(
+// it.filter(hours)
+ copyFromRealm(hours)
+ )
+ }
+ )
+// Blog.LOGE("hour ${hours}")
+ it.notifyDataSetChanged()
+ }
+ mWeatherAdapter?.let {
+ fun onclick() {
+ requireContext().startActivity(Intent().apply {
+ action = Intent.ACTION_VIEW
+ setData(Uri.parse("https://www.accuweather.com/ko/search-locations?query=${LocationGetter.latitude},${LocationGetter.longitude}"))
+ })
+ }
+ binding.weathers.weatherViewPager.setOnTouchListener { v, event ->
+ onclick()
+ true
+ }
+ binding.weathers.weatherViewPager.setOnClickListener { onclick() }
+ binding.weathers.root.setOnClickListener { onclick() }
+ binding.weathers.textLocation =
+ if (hours.isNotEmpty()) WeatherInfoManager.getShowingInfo(hours.first()).textLocation else "도시 / 나라"
+ it.notifyDataSetChanged()
+ }
+ }
+ }
+ }
+ }
+
+
+ // lateinit var weatherJob : Job
+// @SuppressLint("NotifyDataSetChanged")
+ private fun queryWeather() {
+ result = WorkersDb.getRealm().query().also {
+// Blog.LOGE("re >>> ${it.description()}") // 쿼리 로그
+ }.find()
+ weatherJob?.cancel()
+ weatherJob = CoroutineScope(Dispatchers.Default).launch {
+ result?.asFlow()?.collect { li ->
+ //Blog.LOGE("queryWeather done. >>> ${li}")
+ if (li.list.size > 0) {
+ //Blog.LOGE("queryWeather done. >>> ${li.list.size}")
+ queryWeatherWithLoc()
+ }
+ }
+ }
+ weatherJob?.start()
+ }
+
+
+ val onScrChanged = object : RecyclerView.OnScrollListener() {
+ override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
+ super.onScrollStateChanged(recyclerView, newState)
+ commandHandler.removeCallbacks(hideListView)
+ when (newState) {
+ RecyclerView.SCROLL_STATE_IDLE -> {
+ commandHandler.postDelayed(hideListView, hideListViewTime)
+ }
+
+ RecyclerView.SCROLL_STATE_DRAGGING -> {
+ }
+
+ RecyclerView.SCROLL_STATE_SETTLING -> {
+ }
+ }
+ }
+
+ override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
+ super.onScrolled(recyclerView, dx, dy)
+ commandHandler.removeCallbacks(hideListView)
+ }
+ }
+
+ private fun queryNotice() {
+ mNotificationResult = null
+ clearJob(noticeJob)
+ mNotificationResult = WorkersDb.getRealm().query().sort("postTime", Sort.DESCENDING).find()
+ noticeJob = CoroutineScope(Dispatchers.Default).launch {
+ mNotificationResult?.asFlow()?.collect { changes: ResultsChange ->
+ commandHandler.removeCallbacks(hideListView)
+ when (changes) {
+ is UpdatedResults -> {
+ WorkersDb.getRealm().apply {
+ lastedNoti = copyFromRealm(changes.list)
+ }
+ commandHandler.removeCallbacks(notiUpdate)
+ commandHandler.postDelayed(notiUpdate, UPDATE_DELAY)
+ }
+
+ else -> {
+ }
+ }
+ }
+ }
+ noticeJob?.start()
+ }
+ fun clearJob(job : Job?) {
+ try { job?.cancel() } catch (e: Exception) { e.printStackTrace() }
+ try { System.gc() } catch (e: Exception) { e.printStackTrace() }
+ }
+ fun beforeQuery() {
+ clearJob(infosJob)
+ mRssDataResult = null
+ WorkersDb.getRealm().writeBlocking {
+ delete(
+ query()
+ .query("pubDate < $0", beforeDay(30))
+ .query("category != $0 AND category != $1 ", RssDataType.GURU.name, RssDataType.MOST.name)
+ .query("vote != $0", true).find()
+ )
+ }
+ }
+
+ fun updateQuery(q: RealmQuery) {
+ mRssDataResult = q.sort("pubDate ", Sort.DESCENDING).limit(300).distinct("originPage", "title").find()
+ mRssDataResult?.asFlow()?.let { flow ->
+
+ infosJob = CoroutineScope(Dispatchers.IO).launch {
+ flow.collect { changes: ResultsChange ->
+ commandHandler.removeCallbacks(hideListView)
+ commandHandler.removeCallbacks(infoUpdate)
+ WorkersDb.getRealm().apply {
+ lasted = copyFromRealm(changes.list)
+ }
+ commandHandler.postDelayed(infoUpdate, UPDATE_DELAY)
+
+ }
+ }
+ infosJob?.start()
+ }
+
+
+
+ }
+
+ fun queryVotes() {
+ beforeQuery()
+ updateQuery(WorkersDb.getVotedRss())
+ }
+
+ fun queryInfos(
+ filter: Collection? = arrayListOf(RssDataType.GURU, RssDataType.MOST,RssDataType.REDDIT_NSFW), noLimit: Boolean = false
+ ) {
+ beforeQuery()
+ var rQ = WorkersDb.getRealm().query().query("read < $0", nomoreShowCount).distinct("originPage", "title")
+ if (!noLimit) rQ.query("pubDate > $0", beforeOneDay())
+ ((filter?.size ?: 0) > 0).letTrue {filter!!.forEach {rQ = rQ.query("category != $0", it.name)}}
+ updateQuery(rQ)
+ }
+
+ fun queryInfos(
+ keyword: String,
+ category: ArrayList = arrayListOf(),
+ noLimit: Boolean = false
+ ) {
+ beforeQuery()
+ updateQuery(WorkersDb.getRssQuery(keyword,category,noLimit))
+ }
+
+
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+
+ PrefBoolean.displayDateTime.get().letTrue {
+ binding.time.visibility = View.VISIBLE
+ }
+
+
+ PrefBoolean.displayBattery.get().letTrue {
+ binding.batteryProgress.visibility = View.VISIBLE
+ }
+
+ binding.batteryProgress.setOnTouchListener(SimpleFingerGestures(context = requireContext(), binding.batteryProgress, mFingerGestureListener))
+ binding.root.setOnTouchListener(SimpleFingerGestures(context = requireContext(), binding.root, mFingerGestureListener))
+ binding.functionLayer.setOnTouchListener(SimpleFingerGestures(context = requireContext(), binding.functionLayer, mFingerGestureListener))
+ binding.time.setOnTouchListener(SimpleFingerGestures(context = requireContext(), binding.time, mFingerGestureListener))
+
+ Blog.LOGE("onViewCreated()")
+
+ binding.summaryChoose.visibility = View.GONE
+ (PrefBoolean.showCallHistory.get(false) || PrefBoolean.showSMSHistory.get(false) || PrefBoolean.showNotificationHistory.get(false) || PrefBoolean.showNewsHistory.get(false)).letTrue {
+ binding.summaryChoose.visibility = View.VISIBLE
+ binding.missedCalls.visibility = if (PrefBoolean.showCallHistory.get(false)) View.VISIBLE else View.GONE
+ binding.recentSms.visibility = if (PrefBoolean.showSMSHistory.get(false)) View.VISIBLE else View.GONE
+ binding.notice.visibility = if (PrefBoolean.showNotificationHistory.get(false)) View.VISIBLE else View.GONE
+ binding.otherCheck.visibility = if (PrefBoolean.showNewsHistory.get(false)) View.VISIBLE else View.GONE
+ }
+
+ fragManager.addOnBackStackChangedListener {
+ Blog.LOGE("addOnBackStackChangedListener()")
+ shouldResume = if (fragManager.backStackEntryCount == 0) {
+ binding.root.visibility = View.VISIBLE
+ true
+ } else {
+ binding.root.visibility = View.GONE
+ false
+ }
+ }
+
+ var checkListner = object : View.OnClickListener {
+ override fun onClick(v: View?) {
+ commandHandler.removeCallbacks(hideListView)
+ var views = arrayListOf(binding.mainList, binding.smsList, binding.infoList, binding.notiList,binding.appsList)
+ var chechboxs = arrayListOf(binding.missedCalls, binding.recentSms, binding.otherCheck, binding.notice, binding.favApps)
+ chechboxs.remove(v)
+ when (v) {
+ binding.missedCalls -> {
+ binding.missedCalls.isSelected = !binding.missedCalls.isSelected
+ if (binding.missedCalls.isSelected) {
+ views.remove(binding.mainList)
+ binding.mainList.visibility = View.VISIBLE
+ }
+ }
+
+ binding.recentSms -> {
+ binding.recentSms.isSelected = !binding.recentSms.isSelected
+ if (binding.recentSms.isSelected) {
+ views.remove(binding.smsList)
+ binding.smsList.visibility = View.VISIBLE
+ }
+ }
+
+ binding.otherCheck -> {
+ if (binding.otherCheck.isSelected) {
+ if (rssStateVote()) {
+ queryInfos()
+ } else {
+ binding.otherCheck.isSelected = false
+ }
+ } else {
+ queryInfos()
+ binding.otherCheck.isSelected = true
+ views.remove(binding.infoList)
+ binding.infoList.scrollToPosition(0)
+ binding.infoList.visibility = View.VISIBLE
+ }
+ }
+
+ binding.notice -> {
+ if (binding.notice.isSelected) {
+ binding.notice.isSelected = false
+ } else {
+ queryNotice()
+ binding.notice.isSelected = true
+ views.remove(binding.notiList)
+ binding.notiList.visibility = View.VISIBLE
+ }
+ }
+ binding.favApps -> {
+ if (binding.favApps.isSelected) {
+ binding.favApps.isSelected = false
+ } else {
+ binding.favApps.isSelected = true
+ views.remove(binding.appsList)
+ binding.appsList.visibility = View.VISIBLE
+ }
+ }
+ }
+ chechboxs.forEach { it.isSelected = false }
+ views.forEach { it.visibility = View.GONE }
+ chooseAdpater()
+ }
+ }
+
+ binding.otherCheck.setOnClickListener(checkListner)
+ binding.recentSms.setOnClickListener(checkListner)
+ binding.missedCalls.setOnClickListener(checkListner)
+ binding.notice.setOnClickListener(checkListner)
+ binding.favApps.setOnClickListener(checkListner)
+ binding.otherCheck.setOnLongClickListener {
+ queryInfos()
+ true
+ }
+ enableSwipeToDeleteAndUndo()
+ }
+
+
+
+ fun searchData() {
+ val builder: AlertDialog.Builder = AlertDialog.Builder(requireContext())
+ builder.setTitle("Command Line")
+ val viewInflated: View = LayoutInflater.from(context)
+ .inflate(R.layout.search_layout, view as ViewGroup?, false)
+ val input = viewInflated.findViewById(R.id.input) as EditText
+ val categoryz =
+ viewInflated.findViewById(R.id.categoryz) as TableRadioGroup
+ categoryz.setMaxColumns(3)
+ categoryz.setMaxRows(8)
+ categoryz.setOnCheckedChangeListener(object : TableRadioGroup.OnCheckedChangeListener {
+ override fun onCheckedChanged(group: TableRadioGroup?, checkedId: Int) {
+
+ }
+ })
+ var idx = 0
+ RssDataType.values().reversed().toList().chunked(3).forEach {
+ var tb = TableRow(requireContext())
+ it.forEach { c ->
+ if (c.equals(RssDataType.NO_DATA) == false) {
+ tb.addView(
+ CheckBox(requireContext()).apply {
+ this.tag = c.name
+ this.text = c.name
+ }
+ )
+ }
+ }
+ categoryz.addView(tb)
+ }
+
+ builder.setView(viewInflated)
+ builder.setPositiveButton(android.R.string.ok,
+ DialogInterface.OnClickListener { dialog, which ->
+ dialog.dismiss()
+ var category = arrayListOf()
+ categoryz.children.forEach {
+ if (it is TableRow) {
+ it.children.forEach {
+ if (it is CheckBox && it.isChecked) {
+ (it.tag as? String)?.let { category.add(it) }
+ }
+ }
+ }
+ }
+ queryInfos(keyword = input.text.toString(), category, false)
+ })
+ builder.setNegativeButton(android.R.string.cancel,
+ DialogInterface.OnClickListener { dialog, which -> dialog.cancel() })
+ builder.show()
+ }
+
+
+ fun showAl() {
+ binding.alcholKatalkT.visibility = View.VISIBLE
+ binding.alcholKatalkT.setOnClickListener {
+ openSearchApps(
+ "kakaot://taxi?dest_lat=${URLEncoder.encode("37.467696")}&dest_lng=${
+ URLEncoder.encode(
+ "127.101063"
+ )
+ }", "com.kakao.taxi"
+ )
+ }
+
+ }
+
+ fun openSearchApps(schemeString: String, pakage: String? = null) {
+ val gmmIntentUri = Uri.parse(schemeString)
+ val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
+ pakage?.let {
+ mapIntent.setPackage(pakage)
+ }
+ startActivity(mapIntent)
+ }
+
+ fun hideAl() {
+ binding.alcholKatalkT.visibility = View.GONE
+ binding.alcholKatalkT.setOnClickListener {
+
+ }
+ }
+
+ fun chooseAdpater() {
+ commandHandler.removeCallbacks(hideListView)
+ var tabs = arrayOf(binding.missedCalls,binding.recentSms,binding.otherCheck,binding.notice,binding.favApps)
+ fun unsel(view: View) {
+ tabs.filter {
+ it.equals(view) == false
+ }.forEach { it.isSelected = false }
+ }
+ binding.mainList.visibility = View.INVISIBLE
+ binding.smsList.visibility = View.INVISIBLE
+ binding.infoList.visibility = View.INVISIBLE
+ binding.notiList.visibility = View.INVISIBLE
+
+ var dateParam = beforeDay(30).toString()
+ if (binding.missedCalls.isSelected) {
+ WorkersDb.getRealm().apply {
+ val result = query().query("callDayTime >= $0", dateParam)
+ .sort("callDayTime", Sort.DESCENDING).find()
+ val list = copyFromRealm(result)
+ binding.missedCalls.text = "통화 목록 [${list.size}]"
+ binding.mainList.visibility = View.VISIBLE
+ mRecentCallsAdapter.updateData(list)
+ }
+ } else if (binding.recentSms.isSelected) {
+ WorkersDb.getRealm().apply {
+ val result = query().query("rcvDate >= $0 OR pstDate >= $0 ", dateParam)
+ .sort("rcvDate", Sort.DESCENDING).find()
+ if (result.size > 0) {
+ try {
+ binding.recentSms.text = "문자 내역 [${result.size}]"
+ binding.smsList.visibility = View.VISIBLE
+ val list = copyFromRealm(result)
+ mSmsLogsAdapter.updateData(list)
+
+ } catch (e: Exception) {
+
+ }
+ }
+ }
+ } else if (binding.otherCheck.isSelected) {
+ unsel(binding.otherCheck)
+ binding.infoList.visibility = View.VISIBLE
+// binding.otherCheck.text = "글타래 [${lasted?.size ?: "-"}]"
+ lasted?.let { mRssAdapter.updateData(it) }
+ } else if (binding.notice.isSelected) {
+ unsel(binding.notice)
+ binding.notiList.visibility = View.VISIBLE
+// binding.notice.text = "알림 [${lastedNoti?.size ?: "-"}]"
+ lastedNoti?.let { mNotiAdapter.updateData(it) }
+ } else if (binding.favApps.isSelected) {
+ unsel(binding.favApps)
+ binding.appsList.visibility = View.VISIBLE
+ }
+ commandHandler.postDelayed(hideListView, hideListViewTime)
+ }
+
+ private fun enableSwipeToDeleteAndUndo() {
+ val swipeToDeleteCallback: SwipeToDeleteCallback =
+ object : SwipeToDeleteCallback(requireContext()) {
+ override fun onSwiped(@NonNull viewHolder: RecyclerView.ViewHolder, direction: Int) {
+ Blog.LOGE("onSwiped direction >>>> $direction")
+ (viewHolder.itemView.tag as? RssData)?.let { rss ->
+ CoroutineScope(Dispatchers.IO).launch {
+ WorkersDb.getRealm().apply {
+ writeBlocking {
+ when (direction) {
+ ItemTouchHelper.LEFT -> {
+ if (rssStateVote() && rss.vote) {
+ rss.vote = false
+ rss.read = 0
+ } else {
+ rss.read += nomoreShowCount
+ }
+ query(
+ "originPage == $0",
+ rss.originPage
+ ).find().forEach { it ->
+ it.read += nomoreShowCount
+ }
+ }
+
+ ItemTouchHelper.RIGHT -> {
+ if (rssStateVote() && rss.vote) {
+ rss.vote = false
+ rss.read = 0
+ } else {
+ rss.vote = true
+
+ }
+ }
+
+ else -> {}
+ }
+ binding.infoList.post { mRssAdapter.refresh() }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ val itemTouchhelper = ItemTouchHelper(swipeToDeleteCallback)
+ itemTouchhelper.attachToRecyclerView(binding.infoList)
+ }
+
+ override fun onResume() {
+ super.onResume()
+// BLog.LOGE("${this} ::::: onResume >>>> ")
+ if (shouldResume) {
+
+ /* register battery changes */
+ requireContext().registerReceiver(
+ batteryReceiver,
+ IntentFilter(Intent.ACTION_BATTERY_CHANGED)
+ )
+ /* time and date */
+// binding.time.textLocale = Locale.US
+// binding.date.textLocale = Locale.US
+// if (DateFormat.is24HourFormat(requireContext())) {
+// binding.time.format24Hour = timeFormat
+// binding.date.format24Hour = "yyyy년 M월 W주차, dd일 E요일"
+// } else {
+// binding.time.format12Hour = timeFormat
+// binding.date.format12Hour = dateFormat
+// }
+ /* show weather */
+// WeatherExecutor(settingsPrefs).generateWeatherString(binding.weather)
+ }
+// binding.root.visibility = View.VISIBLE
+ }
+
+
+ override fun onPause() {
+ super.onPause()
+ /* unregister battery changes */
+ if (shouldResume) requireContext().unregisterReceiver(batteryReceiver)
+// binding.root.visibility = View.GONE
+ }
+
+
+ var mFingerGestureListener = object : SimpleFingerGestures.OnFingerGestureListener {
+ override fun onSwipeUp(
+ targetView: View,
+ fingers: Int,
+ gestureDuration: Long,
+ gestureDistance: Double
+ ): Boolean {
+ when (fingers) {
+ 4 -> {
+ lActivity!!.startActivity(Intent(requireContext(), Behavior::class.java))
+ }
+
+ 3 -> QuickAccess().show(fragManager, BOTTOM_SHEET_TAG)
+ 2 -> {
+ var startIntene = Intent(Intent.ACTION_MAIN)
+ startIntene.setComponent(
+ ComponentName(
+ "com.mime.dualscreenview",
+ "com.mime.dualscreenview.activity.Intro"
+ )
+ )
+ startActivity(startIntene)
+ }
+ 1->{
+ lActivity?.switchAppDrawer()
+ }
+ else -> {}
+ }
+ return false
+ }
+
+ override fun onSwipeDown(
+ targetView: View,
+ fingers: Int,
+ gestureDuration: Long,
+ gestureDistance: Double
+ ): Boolean {
+ when (fingers) {
+ 2 ->
+ if (targetView.equals(binding.batteryProgress)) {
+ expandNotificationPanel(requireContext())
+ } else {
+ expandNotificationPanel(requireContext())
+ }
+
+ 4 -> {
+ var startIntene = Intent(Intent.ACTION_MAIN)
+ startIntene.setComponent(
+ ComponentName(
+ "com.samsung.android.app.interpreter",
+ "com.samsung.android.app.interpreter.interpretation.view.InterpretationActivity"
+ )
+ )
+ startActivity(startIntene)
+ }
+
+ 3 -> {
+ lActivity!!.startActivity(
+ Intent(
+ requireContext(),
+ SettingsActivity::class.java
+ )
+ )
+ }
+
+ else -> {}
+ }
+ return false
+ }
+
+ override fun onSwipeLeft(
+ targetView: View,
+ fingers: Int,
+ gestureDuration: Long,
+ gestureDistance: Double
+ ): Boolean {
+// if (targetView.equals(binding.time)) {
+// val mClockIntent = Intent(AlarmClock.ACTION_SHOW_ALARMS)
+// mClockIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+// startActivity(mClockIntent)
+// }
+
+ Blog.LOGE("onSwipeLeft targetView. >>>> ${targetView} && ${targetView.equals(binding.functionLayer)}")
+ if(targetView.equals(binding.functionLayer)){
+ targetView?.performHapticFeedback(HapticFeedbackConstants.CONFIRM)
+ when(fingers) {
+ 1->lActivity?.switchAppDrawer()
+ 2-> {
+
+ }
+ else ->{}
+ }
+ } else if (targetView.equals(binding.time) && fingers == 2) {
+ val mClockIntent = Intent(AlarmClock.ACTION_SHOW_ALARMS)
+ mClockIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ startActivity(mClockIntent)
+ }
+ return false
+ }
+
+ override fun onSwipeRight(
+ targetView: View,
+ fingers: Int,
+ gestureDuration: Long,
+ gestureDistance: Double
+ ): Boolean {
+ if(targetView.equals(binding.functionLayer)){
+ targetView?.performHapticFeedback(HapticFeedbackConstants.CONFIRM)
+ when(fingers) {
+ 1-> {
+// lActivity?.switchFeeds()
+ return true
+ }
+ //
+ else ->{}
+ }
+ } else if (targetView.equals(binding.time) && fingers == 2) {
+ val intent = Intent(Intent.ACTION_MAIN)
+ intent.addCategory(Intent.CATEGORY_APP_CALENDAR)
+ startActivity(intent)
+ }
+ return false
+ }
+
+ override fun onPinch(
+ targetView: View,
+ fingers: Int,
+ gestureDuration: Long,
+ gestureDistance: Double
+ ): Boolean {
+ Blog.LOGE("Maybe GA PINCH is Like Zoom out")
+ return false
+ }
+
+ override fun onUnpinch(
+ targetView: View,
+ fingers: Int,
+ gestureDuration: Long,
+ gestureDistance: Double
+ ): Boolean {
+ Blog.LOGE("Maybe GA UN PINCH is Like Zoom In")
+ return false
+ }
+
+ override fun onDoubleTap(targetView: View, fingers: Int): Boolean {
+ targetView?.performHapticFeedback(HapticFeedbackConstants.CONFIRM)
+ when (fingers) {
+ 1 -> lockMethod(settingsPrefs.getInt(KEY_LOCK_METHOD, 0), requireContext(), binding.functionLayer)
+ else -> {
+
+ }
+ }
+ return false
+ }
+
+ override fun onLongPress(targetView: View, fingers: Int): Boolean {
+ if (targetView?.equals(binding.batteryProgress) == true) {
+ lActivity!!.startActivity(Intent(requireContext(), SettingsActivity::class.java))
+ } else if (targetView?.equals(binding.mainList) == true) {
+// when (settingsPrefs.getBoolean(KEY_TODO_LOCK, false)) {
+// false -> launchTodoManager()
+// /* show authentication screen if lock is on */
+// true -> {
+// if (canAuthenticate(requireContext())) {
+// val biometricPrompt =
+// BiometricPrompt(lActivity!!, authenticationCallback)
+// try {
+// biometricPrompt.authenticate(
+// biometricPromptInfo(
+// lActivity!!.getString(
+// R.string.todo_manager
+// )
+// )
+// )
+// } catch (exception: Exception) {
+// exception.printStackTrace()
+// }
+// }
+// }
+// }
+ } else if (targetView?.equals(binding.functionLayer) == true) {
+ targetView?.performHapticFeedback(HapticFeedbackConstants.CONFIRM)
+ if(binding.otherCheck.isSelected && rssStateVote()) {
+ queryInfos()
+ } else {
+ binding.otherCheck.isSelected = true
+ queryVotes()
+ }
+ return true
+ }
+ return false
+ }
+
+ override fun onClick(targetView: View, fingers: Int): Boolean {
+// BLog.LOGE("onClick ${view} , fingers ${fingers}")
+ targetView.performHapticFeedback(HapticFeedbackConstants.CONFIRM)
+ when (fingers) {
+ 1 -> {
+ if (targetView.equals(binding.batteryProgress) == true) {
+ startActivity(Intent(Settings.ACTION_SETTINGS))
+ }else if(targetView.equals(binding.functionLayer)) {
+ if (binding.otherCheck.isSelected) {
+ searchData()
+ }
+// else if (binding.otherCheck.isSelected) {
+// searchData()
+// }
+// else if (binding.otherCheck.isSelected) {
+// searchData()
+// }
+// else if (binding.otherCheck.isSelected) {
+// searchData()
+// }
+// else if (binding.otherCheck.isSelected) {
+// searchData()
+// }
+ else {
+// QuickAccess().show(fragManager, BOTTOM_SHEET_TAG)
+ }
+ }
+ }
+
+ 2 -> {
+ lockMethod(
+ settingsPrefs.getInt(KEY_LOCK_METHOD, 0),
+ requireContext(),
+ binding.functionLayer
+ )
+ }
+
+ else -> {
+
+ }
+ }
+
+ return true
+ }
+
+ }
+
+
+ fun jsonObjLog(pkey: String, key: String, jsonObject: JSONObject) {
+ if (jsonObject.has(key) == true && jsonObject.get(key) is String) {
+ Blog.LOGE("jsonObjLog $pkey String in $key >> ${jsonObject.getString(key)}")
+ } else if (jsonObject.has(key) == true && jsonObject.get(key) is JSONObject) {
+ var obj = jsonObject.getJSONObject(key)
+ Blog.LOGE("jsonObjLog $pkey JSONObject in $key >> ${obj}")
+ obj?.keys()?.forEach {
+// jsonObjLog(key,it, obj)
+ }
+ } else if (jsonObject.has(key) == true && jsonObject.get(key) is JSONArray) {
+ Blog.LOGE("jsonObjLog $pkey JSONArray in $key >> ${jsonObject.getJSONArray(key)}")
+ var array = jsonObject.getJSONArray(key)
+ for (i in 0..<(array?.length() ?: 0)) {
+ if (array?.get(i) is String) {
+
+ } else if (array?.get(i) is JSONObject) {
+ var child = array.getJSONObject(i)
+ child?.keys()?.forEach {
+// jsonObjLog(key, it, child)
+ }
+ } else if (array?.get(i) is JSONArray) {
+ Blog.LOGE("jsonObjLog $pkey JSONArray in $key >> ${array.getJSONArray(i)}")
+ }
+ }
+ } else {
+ Blog.LOGE(
+ "jsonObjLog $pkey else in $key >> ${
+ if (jsonObject.has(key) == true) (jsonObject.get(
+ key
+ )) else ("")
+ }"
+ )
+ }
+ }
+
+
+ /* gestures on root view */
+ @SuppressLint("ClickableViewAccessibility")
+ private fun rootViewGestures() {
+ binding.root.setOnTouchListener(
+ SimpleFingerGestures(
+ context = requireContext(),
+ binding.root,
+ mFingerGestureListener
+ )
+ )
+ }
+
+
+
+ /* gestures on to-do area */
+ @SuppressLint("ClickableViewAccessibility")
+ private fun todosGestures() {
+ binding.mainList.setOnTouchListener(
+ SimpleFingerGestures(
+ context = requireContext(),
+ binding.mainList,
+ mFingerGestureListener
+ )
+ )
+ }
+
+
+
+ /* authentication callback for TodoManager lock */
+ private val authenticationCallback = object : BiometricPrompt.AuthenticationCallback() {
+ override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
+ launchTodoManager()
+ }
+
+ override fun onAuthenticationError(errorCode: Int, errString: CharSequence) {
+ Toast.makeText(
+ requireContext(),
+ lActivity!!.getString(R.string.authentication_error),
+ Toast.LENGTH_SHORT
+ ).show()
+ }
+
+ override fun onAuthenticationFailed() {
+ Toast.makeText(
+ requireContext(),
+ lActivity!!.getString(R.string.authentication_failed),
+ Toast.LENGTH_SHORT
+ ).show()
+ }
+ }
+
+ /* launch TodoManager fragment */
+ private fun launchTodoManager() {
+// fragManager.beginTransaction().replace(R.id.mainFragmentsContainer, TodoManager())
+// .addToBackStack("").commit()
+ }
+
+
+ /* get time format string */
+ private val timeFormat: String
+ get() {
+// when (settingsPrefs.getInt(KEY_TIME_FORMAT, 0)) {
+// 0 -> return if (DateFormat.is24HourFormat(requireContext())) {
+// "kk:mm"
+// } else {
+// "HH:mm a"
+// }
+// 1 -> return "HH:mm a"
+// 2 -> return "kk:mm"
+// }
+ return "a HH : mm"
+ }
+
+ /* get date number suffix */
+ private val dateNumberSuffix: String
+ get() {
+ return when (Calendar.getInstance()[Calendar.DAY_OF_MONTH]) {
+ 1, 21, 31 -> "ˢᵗ"
+ 2, 22 -> "ⁿᵈ"
+ 3, 23 -> "ʳᵈ"
+ else -> "ᵗʰ"
+ }
+ }
+
+ /* get date format string */
+ private val dateFormat: String
+ get() {
+// settingsPrefs.getString(KEY_DATE_FORMAT, DEFAULT_DATE_FORMAT).let {
+// return if (it!!.contains("x")) {
+// it.replace("x", dateNumberSuffix)
+// } else {
+// it
+// }
+// }
+ return "yyyy년 M월 W주차, dd일 E요일"
+ }
+
+}
+
+
+
+
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/RssViewerActivity.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/RssViewerActivity.kt
index 7b3da9f8..619485e5 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/home/RssViewerActivity.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/home/RssViewerActivity.kt
@@ -121,7 +121,7 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
} else {
loadWithIntent = false
}
- webView?.setOnTouchListener(this)
+ webView?.setOnTouchListener(this)
}
private var startX = 0f
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/workers/OpenWeatherGetter.kt b/app/src/main/kotlin/bums/lunatic/launcher/workers/OpenWeatherGetter.kt
index 77d46d1c..6dc3ab64 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/workers/OpenWeatherGetter.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/workers/OpenWeatherGetter.kt
@@ -45,7 +45,7 @@ class OpenWeatherGetter(context: Context, workerParams: WorkerParameters) : Base
}
fun getWeather(latitude: Double, longitude: Double) {
- Blog.LOGE("into getWeather")
+ Blog.LOGE("into getWeather ${PrefString.weatherApiKey.get()}")
///saved weatherForcast
Retrofit.Builder()
.baseUrl(URI_WEATHERAPI)
diff --git a/app/src/main/res/layout/launcher_activity.xml b/app/src/main/res/layout/launcher_activity.xml
index 36f475ff..3ac776bc 100644
--- a/app/src/main/res/layout/launcher_activity.xml
+++ b/app/src/main/res/layout/launcher_activity.xml
@@ -7,12 +7,6 @@
android:id="@+id/mainFragmentsContainer"
android:fitsSystemWindows="true">
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/launcher_home.xml b/app/src/main/res/layout/launcher_home.xml
index 856ae530..fd747a5c 100644
--- a/app/src/main/res/layout/launcher_home.xml
+++ b/app/src/main/res/layout/launcher_home.xml
@@ -7,334 +7,23 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/launcher_home_old.xml b/app/src/main/res/layout/launcher_home_old.xml
new file mode 100644
index 00000000..856ae530
--- /dev/null
+++ b/app/src/main/res/layout/launcher_home_old.xml
@@ -0,0 +1,340 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
index 43e61285..e61672f7 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -9,8 +9,8 @@ buildscript {
}
plugins {
- id ("com.android.application") version "8.8.0" apply false
- id ("com.android.library") version "8.8.0" apply false
+ id ("com.android.application") version "8.10.1" apply false
+ id ("com.android.library") version "8.10.1" apply false
id ("io.realm.kotlin") version "2.0.0" apply false
id("org.jetbrains.kotlin.android") version "2.0.0" apply false
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 0fc8912f..cbc74b3a 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -3,7 +3,8 @@ pluginManagement {
gradlePluginPortal()
google()
mavenCentral()
- jcenter()
+// jcenter()
+ maven (url = "https://maven.mozilla.org/maven2/")
}
}
@@ -11,9 +12,10 @@ pluginManagement {
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
- jcenter()
+// jcenter()
google()
mavenCentral()
+ maven (url = "https://maven.mozilla.org/maven2/")
maven(url = "https://jitpack.io")
}
}