From 773796d36abeaefee804d36e320b248b1aaf6268 Mon Sep 17 00:00:00 2001 From: lunaticbum Date: Mon, 20 Oct 2025 17:20:16 +0900 Subject: [PATCH] ... --- .../bums/lunatic/launcher/LauncherActivity.kt | 168 ++++++----------- .../bums/lunatic/launcher/home/RssHome.kt | 82 +-------- .../launcher/model/RssDataInterface.kt | 8 +- .../launcher/settings/childs/HomeSettings.kt | 2 - .../bums/lunatic/launcher/tokiz/BaseToki.kt | 29 +-- app/src/main/res/layout/launcher_activity.xml | 9 +- app/src/main/res/layout/settings_todo.xml | 172 ++++++++---------- 7 files changed, 144 insertions(+), 326 deletions(-) diff --git a/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt b/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt index b2e94cb0..7abac3c4 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt @@ -155,13 +155,6 @@ open class LauncherActivity : CommonActivity() { KEYCODE_BUTTON_A->{ WorkersDb.getRealm().apply { writeBlocking { -// var ddd = copyFromRealm(WorkersDb.getRssQuery("", arrayListOf(),false).limit(100).query("read == $0", 0).query("vote != $0", true).find()).map { it.originPage() } -// var origin = ddd.first() -// RssViewBuilder(lActivity!!) -// .setRssList(arrayListOf().apply { this.addAll(ddd) }) -// .setRssId(origin) -// .showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false).webViewMixedContentMode(1) -// .show(origin) } } } @@ -180,17 +173,7 @@ open class LauncherActivity : CommonActivity() { KEYCODE_BUTTON_SELECT->{ WorkersDb.getRealm().apply { writeBlocking { - var ddd = copyFromRealm(WorkersDb.getVotedRss().limit(100).find()).map { it.originPage() } - var origin = ddd.first() -// RssViewBuilder(lActivity!!) -// .setRssList(arrayListOf().apply { -// var jjjj = hashSetOf() -// jjjj.addAll(ddd) -// this.addAll(jjjj)} -// ) -// .setRssId(origin) -// .showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false).webViewMixedContentMode(1) -// .show(origin) + } } } @@ -266,12 +249,6 @@ open class LauncherActivity : CommonActivity() { var origin = ddd.first() var jjjj = hashSetOf() jjjj.addAll(ddd) -// RssViewBuilder(lActivity!!) -// .setRssList(arrayListOf().apply { -// this.addAll(jjjj)}) -// .setRssId(origin) -// .showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false).webViewMixedContentMode(1) -// .show(origin) } } } @@ -420,11 +397,6 @@ open class LauncherActivity : CommonActivity() { } } - var isKeyboardVisible = false - - fun setAddr(str : String) { - binding.currentAddress.text = str - } @SuppressLint("NewApi", "MissingPermission", "ClickableViewAccessibility") override fun onCreate(savedInstanceState: Bundle?) { @@ -532,16 +504,9 @@ open class LauncherActivity : CommonActivity() { .replace(R.id.fragment_container, BookmarkPagerFragment()) .commit() } - - R.id.magnet ->{ - supportFragmentManager.beginTransaction() - .replace(R.id.fragment_container, Magnet()) - .commit() - } R.id.setting ->{ startActivity(Intent(this, SettingsActivity::class.java)) } - else -> {} } binding.floatingActionMenu.close(false) @@ -630,21 +595,6 @@ open class LauncherActivity : CommonActivity() { }) } - private fun topPadding(topPadding: Boolean) { - ViewCompat.setOnApplyWindowInsetsListener(binding.root) { view, windowInsets -> - windowInsets.getInsets(WindowInsetsCompat.Type.systemGestures()).let { - val topInset = if (topPadding) { - if (it.top == 0) windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()).top - else it.top - } else 0 - - view.updatePadding(0, topInset, 0, it.bottom) - } - WindowInsetsCompat.CONSUMED - } - } - - val experimentDelegate = object : ExperimentDelegate { override fun onGetExperimentFeature(feature: String): GeckoResult { Blog.LOGE("onGetExperimentFeature $feature") @@ -681,61 +631,61 @@ open class LauncherActivity : CommonActivity() { -fun beforeDay(date: Date): Long { - val cal: Calendar = Calendar.getInstance() - cal.setTime(date) - cal.add(Calendar.DAY_OF_YEAR, -2) - cal.add(Calendar.HOUR, 8) - return cal.timeInMillis -} - -fun openClient(url : String){ - val browserIntent = Intent( - Intent.ACTION_VIEW, Uri.parse( - url - ) - ) - browserIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) - lActivity?.startActivity(browserIntent) -} - -fun openYouTube(schemeString : String) { - val gmmIntentUri = Uri.parse(schemeString) - val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri) - mapIntent.setPackage("com.google.android.youtube") - lActivity?.startActivity(mapIntent) -} - -fun openReddit(schemeString : String) { - Blog.LOGE("schemeString >>>> ${schemeString}") - var uri = schemeString.toUri() - val gmmIntentUri = Uri.parse(schemeString) - val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri) - if(schemeString.contains("reddit")) { - mapIntent.setPackage("com.reddit.frontpage") - } - lActivity?.startActivity(mapIntent) -} - -fun openDotax(schemeString : String) { - val gmmIntentUri = Uri.parse(schemeString) - val mapIntent = Intent(Intent.ACTION_VIEW) -// mapIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP) -// mapIntent.addCategory(Intent.CATEGORY_BROWSABLE) -// mapIntent.setPackage("net.daum.android.cafe") - mapIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) -// mapIntent.setPackage("com.android.chrome") - mapIntent.setData(gmmIntentUri) - lActivity?.startActivity(mapIntent) -} - - -fun openOpera(schemeString : String) { - Blog.LOGE("openOpera ${schemeString}") - val gmmIntentUri = Uri.parse(schemeString) - val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri) - mapIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) - mapIntent.setPackage("com.opera.browser") - lActivity?.startActivity(mapIntent) -} - +//fun beforeDay(date: Date): Long { +// val cal: Calendar = Calendar.getInstance() +// cal.setTime(date) +// cal.add(Calendar.DAY_OF_YEAR, -2) +// cal.add(Calendar.HOUR, 8) +// return cal.timeInMillis +//} +// +//fun openClient(url : String){ +// val browserIntent = Intent( +// Intent.ACTION_VIEW, Uri.parse( +// url +// ) +// ) +// browserIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) +// lActivity?.startActivity(browserIntent) +//} +// +//fun openYouTube(schemeString : String) { +// val gmmIntentUri = Uri.parse(schemeString) +// val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri) +// mapIntent.setPackage("com.google.android.youtube") +// lActivity?.startActivity(mapIntent) +//} +// +//fun openReddit(schemeString : String) { +// Blog.LOGE("schemeString >>>> ${schemeString}") +// var uri = schemeString.toUri() +// val gmmIntentUri = Uri.parse(schemeString) +// val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri) +// if(schemeString.contains("reddit")) { +// mapIntent.setPackage("com.reddit.frontpage") +// } +// lActivity?.startActivity(mapIntent) +//} +// +//fun openDotax(schemeString : String) { +// val gmmIntentUri = Uri.parse(schemeString) +// val mapIntent = Intent(Intent.ACTION_VIEW) +//// mapIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP) +//// mapIntent.addCategory(Intent.CATEGORY_BROWSABLE) +//// mapIntent.setPackage("net.daum.android.cafe") +// mapIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) +//// mapIntent.setPackage("com.android.chrome") +// mapIntent.setData(gmmIntentUri) +// lActivity?.startActivity(mapIntent) +//} +// +// +//fun openOpera(schemeString : String) { +// Blog.LOGE("openOpera ${schemeString}") +// val gmmIntentUri = Uri.parse(schemeString) +// val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri) +// mapIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) +// mapIntent.setPackage("com.opera.browser") +// lActivity?.startActivity(mapIntent) +//} +// diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/RssHome.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/RssHome.kt index c4c1fb84..6ba6cb38 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/home/RssHome.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/home/RssHome.kt @@ -55,7 +55,6 @@ import bums.lunatic.launcher.home.adapters.SwipeToDeleteCallback import bums.lunatic.launcher.model.RssData import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.WeatherForcast -import bums.lunatic.launcher.openReddit import bums.lunatic.launcher.tokiz.view.JxEvent import bums.lunatic.launcher.utils.Blog import bums.lunatic.launcher.utils.SimpleFingerGestures @@ -231,86 +230,11 @@ internal class RssHome : Fragment() { copyToRealm(rss, UpdatePolicy.ALL) } } - when (rss.category()) { - RssDataType.REDDIT_NSFW, RssDataType.PRIVATE -> { - v.findViewById(R.id.circle_preview)?.let { - if (RssDataType.PRIVATE.equals(rss.category())) { - openGecko(rssData = rss) - } else { - if (it.visibility == View.GONE) { - it.visibility = View.VISIBLE - it.postDelayed({ - it.visibility = View.GONE - }, 2000L) - } else { - if (RssDataType.REDDIT_NSFW.equals(rss.category())) { - openReddit(rss.originPage()) - } else if (RssDataType.PRIVATE.equals(rss.category())) { - startActivity(Intent().apply { - action = Intent.ACTION_VIEW - data = Uri.parse(rss.originPage) - }) - } else { - openGecko(rss) - } - } - } - } - } - - RssDataType.REDDIT -> { - openGecko(rss) - } - - RssDataType.DOTAX -> { - openGecko(rss) - } - - RssDataType.YOUTUBE -> { - openGecko(rss) - } - - RssDataType.CLIEN -> { - openGecko(rss) - } - - else -> { - openGecko(rss) - } - } + openGecko(rss) } } fun searchKeyword() { binding.geckoWeb.visibility = View.GONE -// val builder: AlertDialog.Builder = AlertDialog.Builder(requireContext()) -// builder.setTitle("Keyword") -// val viewInflated: View = LayoutInflater.from(requireContext()) -// .inflate(R.layout.text_inpu_password, binding.root as ViewGroup?, false) -// val input = viewInflated.findViewById(R.id.input) as EditText -// val privateMode = viewInflated.findViewById(R.id.private_mode) as CheckBox -// val addVote = viewInflated.findViewById(R.id.add_vote) as CheckBox -// val addRead = viewInflated.findViewById(R.id.add_read) as CheckBox -// privateMode.setOnCheckedChangeListener { v,c-> -// binding.geckoWeb.privateMode = c -// } -// privateMode.visibility = View.GONE -// binding.geckoWeb.privateMode = true -// builder.setView(viewInflated) -// builder.setPositiveButton( -// android.R.string.ok, -// DialogInterface.OnClickListener { dialog, which -> -// dialog.dismiss() -// var command = input.editableText?.toString() -// if (command?.length ?: 0 > 0) { -// queryInfos(keywords = command!!.split(" ")!!, addVote.isChecked, addRead.isChecked) -// } -// }) -// builder.setNegativeButton( -// android.R.string.cancel, -// DialogInterface.OnClickListener { dialog, which -> dialog.cancel() }) -// -// builder.show() - val bottomSheet = SearchBottomSheet() bottomSheet.listener = object : OnSearchListener{ override fun onSearch( @@ -391,12 +315,8 @@ internal class RssHome : Fragment() { binding.geckoWeb.privateMode = false } RssDataType.PRIVATE -> { -// if (binding.geckoWeb.lastedUrl?.contains("naver") == true) { -// -// } else { binding.geckoWeb.privateMode = privateMode binding.geckoWeb.loadUrl("aHR0cHM6Ly9pamF2dG9ycmVudC5jb20=", if (keyword.length ?: 0 > 0) {"/?searchTerm=${keyword}"} else {null}) -// } } else -> { diff --git a/app/src/main/kotlin/bums/lunatic/launcher/model/RssDataInterface.kt b/app/src/main/kotlin/bums/lunatic/launcher/model/RssDataInterface.kt index 50822956..e60c32c6 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/model/RssDataInterface.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/model/RssDataInterface.kt @@ -2,6 +2,7 @@ package bums.lunatic.launcher.model import android.view.View import bums.lunatic.launcher.R +import bums.lunatic.launcher.helpers.PrefHelper enum class RssDataType { NO_DATA, @@ -50,10 +51,9 @@ enum class RssDataType { } fun isOn(block : ()->Unit) { - block.invoke() -// if(PrefHelper.getBoolean(name,false)) { -// block.invoke() -// } + if(PrefHelper.getBoolean(name,false)) { + block.invoke() + } } companion object { diff --git a/app/src/main/kotlin/bums/lunatic/launcher/settings/childs/HomeSettings.kt b/app/src/main/kotlin/bums/lunatic/launcher/settings/childs/HomeSettings.kt index 25a1364d..748c2f3e 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/settings/childs/HomeSettings.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/settings/childs/HomeSettings.kt @@ -44,7 +44,6 @@ internal class HomeSettings : BottomSheetDialogFragment() { binding = SettingsTodoBinding.inflate(inflater, container, false) - setTableItem(binding.admin02) setTableItem(binding.admin01) setTableItem(binding.normal01) setTableItem(binding.normal02) @@ -71,7 +70,6 @@ internal class HomeSettings : BottomSheetDialogFragment() { if(!PrefHelper.getBoolean("rootPermisssion",false)) { binding.admin01.visibility = View.GONE - binding.admin02.visibility = View.GONE } return binding.root diff --git a/app/src/main/kotlin/bums/lunatic/launcher/tokiz/BaseToki.kt b/app/src/main/kotlin/bums/lunatic/launcher/tokiz/BaseToki.kt index fc9f342a..8ed71c39 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/tokiz/BaseToki.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/tokiz/BaseToki.kt @@ -650,7 +650,7 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface { }, { e: Throwable? -> Log.e("MessageDelegate", "Error registering WebExtension", e) }) } - val nullCursor = PointerIcon.getSystemIcon(context!!, PointerIcon.TYPE_NULL) + val nullCursor = PointerIcon.getSystemIcon(requireContext(), PointerIcon.TYPE_NULL) binding.root.setPointerIcon(nullCursor) @@ -684,7 +684,7 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface { override fun onResume() { super.onResume() - val nullCursor = PointerIcon.getSystemIcon(context!!, PointerIcon.TYPE_NULL) + val nullCursor = PointerIcon.getSystemIcon(requireContext(), PointerIcon.TYPE_NULL) binding.root.setPointerIcon(nullCursor) loadLastInfo() } @@ -957,31 +957,6 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface { } - var saveClient = object : WebViewClient() { - override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) { - super.onPageStarted(view, url, favicon) - - } - - override fun onPageFinished(webView: WebView?, url: String?) { - super.onPageFinished(webView, url) -// val delayed = 3500L + Math.abs(Random.nextLong().rem(9999L)) - finishedUrl = url ?: "" - webView?.postDelayed({ - webView?.evaluateJavascript( - "function getAll() {\n" + - " MyJavaScriptInterface.sendValueFromHtml(document.getElementsByTagName('html')[0].innerHTML)" + - " };getAll()" - ) { result -> - (result as? String)?.let { - - } - } - }, delayed) - } - - - } fun showToast(origin: String) { activity?.runOnUiThread { diff --git a/app/src/main/res/layout/launcher_activity.xml b/app/src/main/res/layout/launcher_activity.xml index 007e2502..a1b0c044 100644 --- a/app/src/main/res/layout/launcher_activity.xml +++ b/app/src/main/res/layout/launcher_activity.xml @@ -137,14 +137,7 @@ android:layout_width="wrap_content" android:layout_height="20dp"/> - + - - - - - - - - - + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - + - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - + + + + + + + + + + \ No newline at end of file