...
This commit is contained in:
@@ -148,17 +148,49 @@ internal class AppDrawer : Fragment() {
|
||||
binding.searchTranslate.setOnClickListener {
|
||||
openSearchApps("https://translate.google.com/?hl=ko&sl=ko&tl=en&text=${getInputText()}&op=translate","com.android.chrome")
|
||||
}
|
||||
binding.searchStore.setOnClickListener {
|
||||
openSearchApps("market://search?q=${getInputText()}")
|
||||
}
|
||||
binding.runSend.setOnClickListener {
|
||||
sendMsg()
|
||||
}
|
||||
binding.runTelegram.setOnClickListener {
|
||||
sendMsg("tg://msg?text=${getInputText()}&to=","org.telegram.messenger")
|
||||
}
|
||||
binding.runKatalk.setOnClickListener {
|
||||
sendMsg(pkg = "com.kakao.talk")
|
||||
}
|
||||
setLayout()
|
||||
|
||||
return binding.root
|
||||
}
|
||||
|
||||
fun sendMsg(scheme : String? = null , pkg : String? = null) {
|
||||
var postIntent : Intent? = null
|
||||
if (scheme != null && scheme.length > 1) {
|
||||
postIntent = Intent(Intent.ACTION_VIEW,Uri.parse(scheme))
|
||||
} else {
|
||||
postIntent = Intent(Intent.ACTION_SEND)
|
||||
postIntent.type = "text/plain"
|
||||
postIntent.putExtra(Intent.EXTRA_TEXT, "${getInputText()}")
|
||||
}
|
||||
if (pkg != null && pkg.length > 1) {
|
||||
postIntent?.setPackage(pkg)
|
||||
startActivity(postIntent)
|
||||
} else {
|
||||
val chooserTitle = "바로 보냄"
|
||||
startActivity(Intent.createChooser(postIntent, chooserTitle))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
val contactList = arrayListOf<SimpleContact>()
|
||||
private fun GetContact() {
|
||||
if (originContactList.size > 0) {
|
||||
|
||||
contactList.clear()
|
||||
for (item in originContactList) {
|
||||
contactList.add(item)
|
||||
}
|
||||
} else {
|
||||
contactList.clear()
|
||||
originContactList.clear()
|
||||
@@ -224,6 +256,14 @@ internal class AppDrawer : Fragment() {
|
||||
// }
|
||||
// }
|
||||
|
||||
binding.searchInput.setOnKeyListener { v, keyCode, event ->
|
||||
if (keyCode == 66 && contactList.size < 1 && packageList.size < 1) {
|
||||
binding.searchGoogle.performClick()
|
||||
true
|
||||
}else {
|
||||
false
|
||||
}
|
||||
}
|
||||
binding.searchInput.doOnTextChanged { inputText, _, _, _ ->
|
||||
binding.searchInput.text?.let { binding.searchInput.setSelection(it.length) }
|
||||
filterAppsList(inputText.toString())
|
||||
@@ -235,8 +275,6 @@ internal class AppDrawer : Fragment() {
|
||||
super.onResume()
|
||||
fetchApps()
|
||||
GetContact()
|
||||
setKeyboardPadding()
|
||||
|
||||
binding.appsCount.visibility = if (settingsPrefs!!.getBoolean(KEY_APPS_COUNT, true)) VISIBLE else GONE
|
||||
|
||||
if (settingsPrefs!!.getInt(KEY_APPS_LAYOUT, 0) in 0..1) {
|
||||
@@ -245,8 +283,7 @@ internal class AppDrawer : Fragment() {
|
||||
|
||||
contactAdapter?.updateData(contactList)
|
||||
|
||||
/* pop up the keyboard */
|
||||
if (settingsPrefs!!.getBoolean(KEY_KEYBOARD_SEARCH, false)) openSearch()
|
||||
openSearch()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
@@ -398,6 +435,7 @@ internal class AppDrawer : Fragment() {
|
||||
}
|
||||
contactAdapter?.updateData(contactList)
|
||||
BLog.LOGE("END FILTER")
|
||||
|
||||
} else if(lastSearchStringLength == 0){
|
||||
contactList.clear()
|
||||
for (item in originContactList) {
|
||||
|
||||
Reference in New Issue
Block a user