diff --git a/app/src/main/kotlin/rasel/lunar/launcher/apps/AppDrawer.kt b/app/src/main/kotlin/rasel/lunar/launcher/apps/AppDrawer.kt index 9570740..a933c11 100644 --- a/app/src/main/kotlin/rasel/lunar/launcher/apps/AppDrawer.kt +++ b/app/src/main/kotlin/rasel/lunar/launcher/apps/AppDrawer.kt @@ -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() 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) { diff --git a/app/src/main/res/drawable/katalk.png b/app/src/main/res/drawable/katalk.png new file mode 100644 index 0000000..e154b6a Binary files /dev/null and b/app/src/main/res/drawable/katalk.png differ diff --git a/app/src/main/res/drawable/playstore.png b/app/src/main/res/drawable/playstore.png new file mode 100644 index 0000000..f1d78c4 Binary files /dev/null and b/app/src/main/res/drawable/playstore.png differ diff --git a/app/src/main/res/drawable/send.png b/app/src/main/res/drawable/send.png new file mode 100644 index 0000000..297e12b Binary files /dev/null and b/app/src/main/res/drawable/send.png differ diff --git a/app/src/main/res/drawable/telegram.png b/app/src/main/res/drawable/telegram.png new file mode 100644 index 0000000..eb96102 Binary files /dev/null and b/app/src/main/res/drawable/telegram.png differ diff --git a/app/src/main/res/layout/app_drawer.xml b/app/src/main/res/layout/app_drawer.xml index e200984..fb71cb0 100644 --- a/app/src/main/res/layout/app_drawer.xml +++ b/app/src/main/res/layout/app_drawer.xml @@ -20,6 +20,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 46c24b8..85b2a01 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -24,12 +24,15 @@