Compare commits

..

2 Commits

Author SHA1 Message Date
ed24af2d41 Merge branch 'main' of https://dev.lunaticbum.kr/lun_admin/lun_launcher
# Conflicts:
#	app/src/main/kotlin/rasel/lunar/launcher/apps/AppDrawer.kt
2024-08-22 20:44:27 +09:00
1024eda64d ... 2024-08-22 20:39:57 +09:00
7 changed files with 136 additions and 41 deletions

View File

@ -146,46 +146,49 @@ internal class AppDrawer : Fragment() {
binding.searchTranslate.setOnClickListener { binding.searchTranslate.setOnClickListener {
openSearchApps("https://translate.google.com/?hl=ko&sl=ko&tl=en&text=${getInputText()}&op=translate","com.android.chrome") openSearchApps("https://translate.google.com/?hl=ko&sl=ko&tl=en&text=${getInputText()}&op=translate","com.android.chrome")
} }
binding.searchStore.setOnClickListener {
binding.searchCoupang.setOnClickListener { openSearchApps("market://search?q=${getInputText()}")
openSearchApps("coupang://search?q=${getInputText()}","com.coupang.mobile")
} }
binding.runSend.setOnClickListener {
binding.reset.setOnClickListener { filterAppsList("") } sendMsg()
binding.searchInput.setOnKeyListener { v, keyCode, event ->
BLog.LOGE("v == ${v}, keyCode == ${keyCode}, event == ${event}")
BLog.LOGE("isAdded == ${isAdded}, isResumed == ${isResumed}, isVisible == ${isVisible}")
clearCancelSearch()
if (v.equals(binding.searchInput) && keyCode == 66 && isAdded && isResumed && isVisible && lActivity?.hasWindowFocus() == true && event.action == ACTION_UP) {
try {
if (lastSearchString.length > 0) {
checkResult(binding.searchInput.text.toString())
} }
return@setOnKeyListener true binding.runTelegram.setOnClickListener {
} catch (e :Exception) { sendMsg("tg://msg?text=${getInputText()}&to=","org.telegram.messenger")
e.printStackTrace()
} }
} binding.runKatalk.setOnClickListener {
return@setOnKeyListener false sendMsg(pkg = "com.kakao.talk")
}
binding.searchInput.doOnTextChanged { inputText, _, _, _ ->
clearCancelSearch()
binding.searchInput.text?.let { binding.searchInput.setSelection(it.length) }
filterAppsList(inputText.toString())
} }
setLayout() setLayout()
return binding.root 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>() val contactList = arrayListOf<SimpleContact>()
private fun GetContact() { private fun GetContact() {
if (originContactList.size > 0) { if (originContactList.size > 0) {
contactList.clear()
for (item in originContactList) {
contactList.add(item)
}
} else { } else {
contactList.clear() contactList.clear()
originContactList.clear() originContactList.clear()
@ -234,7 +237,18 @@ internal class AppDrawer : Fragment() {
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
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())
}
} }
fun checkResult(keyword: String) { fun checkResult(keyword: String) {
@ -320,6 +334,8 @@ internal class AppDrawer : Fragment() {
} }
} }
fun runonUi(invoke : () -> Unit) { fun runonUi(invoke : () -> Unit) {
Handler(Looper.getMainLooper()).run { Handler(Looper.getMainLooper()).run {
try { try {
@ -336,6 +352,16 @@ internal class AppDrawer : Fragment() {
BLog.LOGE("onResume") BLog.LOGE("onResume")
fetchApps() fetchApps()
GetContact() GetContact()
binding.appsCount.visibility = if (settingsPrefs!!.getBoolean(KEY_APPS_COUNT, true)) VISIBLE else GONE
// if (settingsPrefs!!.getInt(KEY_APPS_LAYOUT, 0) in 0..1) {
// appsAdapter?.updateGravity(settingsPrefs!!.getInt(KEY_DRAW_ALIGN, Gravity.CENTER))
// }
contactAdapter?.updateData(contactList)
openSearch()
setKeyboardPadding() setKeyboardPadding()
contactAdapter?.updateData(contactList) contactAdapter?.updateData(contactList)
@ -465,8 +491,22 @@ internal class AppDrawer : Fragment() {
contactList.sortBy { it.name } contactList.sortBy { it.name }
contactAdapter?.updateData(contactList) contactAdapter?.updateData(contactList)
BLog.LOGE("END FILTER") BLog.LOGE("END FILTER")
} else if(lastSearchStringLength == 0){
contactList.clear()
for (item in originContactList) {
contactList.add(item)
}
packageList.clear()
for (resolver in oringinPackageList) {
packageList.add(resolver)
}
appsAdapter?.updateData(packageList)
contactAdapter?.updateData(contactList)
} else { } else {
afterClearSearch() afterClearSearch()
} }
lastSearchString = searchString lastSearchString = searchString
lastSearchStringLength = searchString.length lastSearchStringLength = searchString.length

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -20,6 +20,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<TextView <TextView
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:paddingLeft="15dp" android:paddingLeft="15dp"
android:paddingRight="15dp" android:paddingRight="15dp"
android:id="@+id/title_apps" android:id="@+id/title_apps"
@ -48,6 +50,8 @@
android:scrollbars="none" android:scrollbars="none"
/> />
<TextView <TextView
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:paddingLeft="15dp" android:paddingLeft="15dp"
android:paddingRight="15dp" android:paddingRight="15dp"
android:id="@+id/title_webs" android:id="@+id/title_webs"
@ -78,6 +82,13 @@
android:src="@drawable/namuwiki" android:src="@drawable/namuwiki"
android:id="@+id/search_namuwiki" android:id="@+id/search_namuwiki"
style="@style/SearchIcons"/> style="@style/SearchIcons"/>
</LinearLayout>
<LinearLayout
android:id="@+id/quickSearch2"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@id/quickSearch"
android:layout_width="match_parent"
android:layout_height="50dp">
<rasel.lunar.launcher.view.CircleImageView <rasel.lunar.launcher.view.CircleImageView
style="@style/SearchIcons" style="@style/SearchIcons"
android:src="@drawable/gmap" android:src="@drawable/gmap"
@ -94,20 +105,15 @@
android:src="@drawable/translate" android:src="@drawable/translate"
style="@style/SearchIcons" style="@style/SearchIcons"
android:id="@+id/search_translate"/> android:id="@+id/search_translate"/>
</LinearLayout>
<LinearLayout
android:id="@+id/quickSearch2"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@id/quickSearch"
android:layout_width="match_parent"
android:layout_height="50dp">
<rasel.lunar.launcher.view.CircleImageView <rasel.lunar.launcher.view.CircleImageView
android:src="@drawable/playstore"
style="@style/SearchIcons" style="@style/SearchIcons"
android:src="@drawable/coupang" android:id="@+id/search_store"/>
android:id="@+id/search_coupang"/>
</LinearLayout> </LinearLayout>
<TextView <TextView
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:paddingLeft="15dp" android:paddingLeft="15dp"
android:paddingRight="15dp" android:paddingRight="15dp"
android:id="@+id/title_contact" android:id="@+id/title_contact"
@ -125,6 +131,52 @@
android:overScrollMode="never" android:overScrollMode="never"
android:requiresFadingEdge="horizontal" android:requiresFadingEdge="horizontal"
android:scrollbars="none"/> android:scrollbars="none"/>
<TextView
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:id="@+id/title_run"
app:layout_constraintTop_toBottomOf="@id/contactList"
app:layout_constraintLeft_toLeftOf="parent"
android:text="빠른 실행"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="@+id/quickRun"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@id/title_run"
android:layout_width="match_parent"
android:layout_height="50dp">
<rasel.lunar.launcher.view.CircleImageView
style="@style/SearchIcons"
android:src="@drawable/send"
android:id="@+id/run_send"/>
<rasel.lunar.launcher.view.CircleImageView
style="@style/SearchIcons"
android:src="@drawable/telegram"
android:id="@+id/run_telegram"/>
<rasel.lunar.launcher.view.CircleImageView
style="@style/SearchIcons"
android:src="@drawable/katalk"
android:id="@+id/run_katalk"/>
<!-- <rasel.lunar.launcher.view.CircleImageView-->
<!-- style="@style/SearchIcons"-->
<!-- android:src="@drawable/navermap"-->
<!-- android:id="@+id/search_nmap"/>-->
<!-- <rasel.lunar.launcher.view.CircleImageView-->
<!-- android:src="@drawable/tmap"-->
<!-- style="@style/SearchIcons"-->
<!-- android:id="@+id/search_tmap"/>-->
<!-- <rasel.lunar.launcher.view.CircleImageView-->
<!-- android:src="@drawable/translate"-->
<!-- style="@style/SearchIcons"-->
<!-- android:id="@+id/search_translate"/>-->
<!-- <rasel.lunar.launcher.view.CircleImageView-->
<!-- android:src="@drawable/playstore"-->
<!-- style="@style/SearchIcons"-->
<!-- android:id="@+id/search_store"/>-->
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView> </ScrollView>

View File

@ -24,12 +24,15 @@
<style name="SearchIcons"> <style name="SearchIcons">
<item name="android:layout_margin">5dp</item> <item name="android:layout_marginTop">2.5dp</item>
<item name="android:layout_marginLeft">10dp</item>
<item name="android:layout_marginRight">10dp</item>
<item name="android:layout_marginBottom">2.5dp</item>
<item name="android:adjustViewBounds">true</item> <item name="android:adjustViewBounds">true</item>
<item name="android:scaleType">fitCenter</item> <item name="android:scaleType">fitCenter</item>
<item name="android:background">@null</item> <item name="android:background">@null</item>
<item name="android:layout_width">40dp</item> <item name="android:layout_width">45dp</item>
<item name="android:layout_height">40dp</item> <item name="android:layout_height">45dp</item>
<item name="civ_border_width">1dp</item> <item name="civ_border_width">1dp</item>
<item name="civ_border_color">#000000</item> <item name="civ_border_color">#000000</item>
</style> </style>