Compare commits
2 Commits
e51d596431
...
ed24af2d41
| Author | SHA1 | Date | |
|---|---|---|---|
| ed24af2d41 | |||
| 1024eda64d |
@ -146,46 +146,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.searchCoupang.setOnClickListener {
|
||||
openSearchApps("coupang://search?q=${getInputText()}","com.coupang.mobile")
|
||||
binding.searchStore.setOnClickListener {
|
||||
openSearchApps("market://search?q=${getInputText()}")
|
||||
}
|
||||
|
||||
binding.reset.setOnClickListener { filterAppsList("") }
|
||||
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
|
||||
} catch (e :Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
return@setOnKeyListener false
|
||||
binding.runSend.setOnClickListener {
|
||||
sendMsg()
|
||||
}
|
||||
|
||||
|
||||
binding.searchInput.doOnTextChanged { inputText, _, _, _ ->
|
||||
clearCancelSearch()
|
||||
binding.searchInput.text?.let { binding.searchInput.setSelection(it.length) }
|
||||
filterAppsList(inputText.toString())
|
||||
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()
|
||||
@ -234,7 +237,18 @@ internal class AppDrawer : Fragment() {
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
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) {
|
||||
@ -320,6 +334,8 @@ internal class AppDrawer : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun runonUi(invoke : () -> Unit) {
|
||||
Handler(Looper.getMainLooper()).run {
|
||||
try {
|
||||
@ -336,6 +352,16 @@ internal class AppDrawer : Fragment() {
|
||||
BLog.LOGE("onResume")
|
||||
fetchApps()
|
||||
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()
|
||||
|
||||
contactAdapter?.updateData(contactList)
|
||||
@ -465,8 +491,22 @@ internal class AppDrawer : Fragment() {
|
||||
contactList.sortBy { it.name }
|
||||
contactAdapter?.updateData(contactList)
|
||||
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 {
|
||||
afterClearSearch()
|
||||
|
||||
}
|
||||
lastSearchString = searchString
|
||||
lastSearchStringLength = searchString.length
|
||||
|
||||
BIN
app/src/main/res/drawable/katalk.png
Normal file
BIN
app/src/main/res/drawable/katalk.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
BIN
app/src/main/res/drawable/playstore.png
Normal file
BIN
app/src/main/res/drawable/playstore.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
BIN
app/src/main/res/drawable/send.png
Normal file
BIN
app/src/main/res/drawable/send.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
app/src/main/res/drawable/telegram.png
Normal file
BIN
app/src/main/res/drawable/telegram.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
@ -20,6 +20,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:id="@+id/title_apps"
|
||||
@ -48,6 +50,8 @@
|
||||
android:scrollbars="none"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:id="@+id/title_webs"
|
||||
@ -78,6 +82,13 @@
|
||||
android:src="@drawable/namuwiki"
|
||||
android:id="@+id/search_namuwiki"
|
||||
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
|
||||
style="@style/SearchIcons"
|
||||
android:src="@drawable/gmap"
|
||||
@ -94,20 +105,15 @@
|
||||
android:src="@drawable/translate"
|
||||
style="@style/SearchIcons"
|
||||
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
|
||||
android:src="@drawable/playstore"
|
||||
style="@style/SearchIcons"
|
||||
android:src="@drawable/coupang"
|
||||
android:id="@+id/search_coupang"/>
|
||||
|
||||
android:id="@+id/search_store"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:id="@+id/title_contact"
|
||||
@ -125,6 +131,52 @@
|
||||
android:overScrollMode="never"
|
||||
android:requiresFadingEdge="horizontal"
|
||||
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>
|
||||
</ScrollView>
|
||||
|
||||
|
||||
@ -24,12 +24,15 @@
|
||||
|
||||
|
||||
<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:scaleType">fitCenter</item>
|
||||
<item name="android:background">@null</item>
|
||||
<item name="android:layout_width">40dp</item>
|
||||
<item name="android:layout_height">40dp</item>
|
||||
<item name="android:layout_width">45dp</item>
|
||||
<item name="android:layout_height">45dp</item>
|
||||
<item name="civ_border_width">1dp</item>
|
||||
<item name="civ_border_color">#000000</item>
|
||||
</style>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user