....
This commit is contained in:
@@ -21,7 +21,9 @@ package bums.lunatic.launcher
|
||||
//import rasel.lunar.launcher.home.LauncherHome.Companion.rssSet
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.SearchManager
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.content.res.Configuration
|
||||
@@ -73,6 +75,7 @@ import bums.lunatic.launcher.helpers.Constants.Companion.KEY_STATUS_BAR
|
||||
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS
|
||||
import bums.lunatic.launcher.helpers.Constants.Companion.widgetHostId
|
||||
import bums.lunatic.launcher.helpers.HeadsetActionButtonReceiver
|
||||
import bums.lunatic.launcher.helpers.PrefHelper.putString
|
||||
import bums.lunatic.launcher.helpers.PrefLong
|
||||
import bums.lunatic.launcher.home.RssHome
|
||||
import bums.lunatic.launcher.home.RssViewBuilder
|
||||
@@ -129,7 +132,7 @@ import java.util.concurrent.TimeUnit
|
||||
import kotlin.jvm.java
|
||||
|
||||
|
||||
internal class LauncherActivity : CommonActivity() {
|
||||
open class LauncherActivity : CommonActivity() {
|
||||
|
||||
private lateinit var binding: LauncherActivityBinding
|
||||
private lateinit var settingsPrefs: SharedPreferences
|
||||
@@ -464,6 +467,8 @@ internal class LauncherActivity : CommonActivity() {
|
||||
}
|
||||
// BLog.LOGE("onNewIntent intent?.dataString >> ${intent?.dataString}")
|
||||
// BLog.LOGE("onNewIntent intent?.data >> ${intent?.data}")
|
||||
} else if (intent?.action == Intent.ACTION_WEB_SEARCH) {
|
||||
openWithIntent(intent)
|
||||
} else {
|
||||
Blog.LOGE("onNewIntent intent?.hasExtra >> ${intent?.hasExtra(Intent.EXTRA_STREAM)}")
|
||||
|
||||
@@ -501,6 +506,22 @@ internal class LauncherActivity : CommonActivity() {
|
||||
// }
|
||||
super.onNewIntent(intent)
|
||||
}
|
||||
|
||||
private fun openWithIntent(intent: Intent){
|
||||
Blog.LOGE("intent >> ${intent}")
|
||||
|
||||
intent.getStringExtra(SearchManager.QUERY)?.let { query->
|
||||
Blog.LOGE("intent >> ${query}")
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(R.id.fragment_container, RssHome().apply {
|
||||
arguments = Bundle().apply {
|
||||
putString(SearchManager.QUERY, query)
|
||||
}
|
||||
})
|
||||
.commit()
|
||||
}
|
||||
}
|
||||
|
||||
var isKeyboardVisible = false
|
||||
|
||||
@SuppressLint("NewApi", "MissingPermission")
|
||||
@@ -538,6 +559,10 @@ internal class LauncherActivity : CommonActivity() {
|
||||
Blog.LOGE("v >> ${v}")
|
||||
showContents(v.id)
|
||||
}
|
||||
|
||||
if (intent?.action == Intent.ACTION_WEB_SEARCH) {
|
||||
openWithIntent(intent)
|
||||
}
|
||||
}
|
||||
|
||||
fun showContents(id : Int) {
|
||||
@@ -635,7 +660,19 @@ internal class LauncherActivity : CommonActivity() {
|
||||
Blog.LOGE("LauncherActivity onResume")
|
||||
}
|
||||
|
||||
|
||||
private fun openSearch() {
|
||||
val searchManager = getSystemService(Context.SEARCH_SERVICE) as SearchManager
|
||||
val searchableInfo = searchManager.getSearchableInfo(componentName)
|
||||
if (searchableInfo != null) {
|
||||
val intent = Intent(Intent.ACTION_SEARCH).apply {
|
||||
// setSearchableInfo(searchableInfo)
|
||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
}
|
||||
startActivity(intent)
|
||||
} else {
|
||||
// 검색 가능한 앱이 없을 경우 처리
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
val appDrawer by lazy { AppDrawer() }
|
||||
|
||||
@@ -57,7 +57,7 @@ import java.util.concurrent.TimeUnit
|
||||
import java.util.regex.Pattern
|
||||
|
||||
|
||||
internal class AppDrawer : CommonActivity() {
|
||||
class AppDrawer : CommonActivity() {
|
||||
|
||||
private lateinit var binding: AppDrawerBinding
|
||||
private var layoutType: Int = 0
|
||||
|
||||
@@ -888,6 +888,8 @@ class GeckoWeb : BWebview {
|
||||
}
|
||||
} else if (url.startsWith("http") == false) {
|
||||
nUrl = lastDomain
|
||||
} else {
|
||||
nUrl = url.plus(param)
|
||||
}
|
||||
if (!privateMode && this.isVisible == false) {
|
||||
this.visibility = View.VISIBLE
|
||||
|
||||
@@ -199,12 +199,16 @@ internal class RssHome : Fragment() {
|
||||
return false
|
||||
}
|
||||
})
|
||||
var useHiddenMenu = true
|
||||
var openQuery = ""
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
Blog.LOGE("arguments >>> ${arguments}")
|
||||
arguments?.let {
|
||||
if(it.containsKey("HIDDEN") && it.getBoolean("HIDDEN")) {
|
||||
useHiddenMenu = true
|
||||
Blog.LOGE("arguments >>> ${arguments}")
|
||||
if(it.containsKey("query") && it.getString("query")!!.length > 0) {
|
||||
Blog.LOGE("it.getString ${it.getString("query")}")
|
||||
openQuery = it.getString("query")!!
|
||||
|
||||
}
|
||||
}
|
||||
home = this
|
||||
@@ -334,7 +338,7 @@ internal class RssHome : Fragment() {
|
||||
if (binding.geckoWeb.lastedUrl?.contains("www.google") == true) {
|
||||
binding.geckoWeb.sendSearch(keyword)
|
||||
} else {
|
||||
binding.geckoWeb.loadUrl("https://www.google.com/", if (keyword.length ?: 0 > 0) { "/?q=${keyword}" } else { null })
|
||||
binding.geckoWeb.loadUrl("https://www.google.com/", if (keyword.length ?: 0 > 0) { "search/?q=${keyword}" } else { null })
|
||||
}
|
||||
binding.geckoWeb.privateMode = false
|
||||
}
|
||||
@@ -502,33 +506,10 @@ internal class RssHome : Fragment() {
|
||||
binding.share.setOnClickListener {
|
||||
binding.geckoWeb.saveMd()
|
||||
}
|
||||
Blog.LOGE("useHiddenMenu >>> $useHiddenMenu")
|
||||
if (useHiddenMenu) {
|
||||
binding.search.setOnLongClickListener {
|
||||
if (binding.geckoWeb.isVisible) {
|
||||
binding.geckoWeb.visibility = View.GONE
|
||||
}
|
||||
binding.geckoWeb.visibility = View.GONE
|
||||
ask()
|
||||
true
|
||||
}
|
||||
binding.search.setOnClickListener {
|
||||
if (binding.geckoWeb.isVisible) {
|
||||
binding.geckoWeb.visibility = View.GONE
|
||||
}
|
||||
binding.geckoWeb.visibility = View.GONE
|
||||
searchKeyword()
|
||||
true
|
||||
}
|
||||
binding.privateBtn.setOnClickListener {
|
||||
queryPrevate(true)
|
||||
}
|
||||
binding.privateBtn.setOnLongClickListener {
|
||||
queryPrevate(false)
|
||||
true
|
||||
}
|
||||
binding.privateBtn.visibility = View.VISIBLE
|
||||
binding.search.visibility = View.VISIBLE
|
||||
Blog.LOGE("useHiddenMenu >>> $openQuery")
|
||||
if (openQuery.length > 0) {
|
||||
binding.geckoWeb.loadUrl("https://www.google.com/search?q=${openQuery}")
|
||||
openQuery = ""
|
||||
} else {
|
||||
binding.privateBtn.visibility = View.GONE
|
||||
binding.search.visibility = View.GONE
|
||||
|
||||
Reference in New Issue
Block a user