Fix Custom Location bug
This commit is contained in:
@ -51,7 +51,7 @@ class ChooseApplicationActivity : AppCompatActivity() {
|
||||
location.addTextChangedListener(object: TextWatcher {
|
||||
override fun afterTextChanged(text: Editable?) {
|
||||
Thread().run {
|
||||
val appsFiltered = appList.filter { pm.getApplicationLabel(it).toString().contains(text.toString(), true) }
|
||||
val appsFiltered = if (text == null || text.equals("")) appList else appList.filter { pm.getApplicationLabel(it).toString().contains(text.toString(), true) }
|
||||
EventBus.getDefault().post(ApplicationListEvent(appsFiltered, true))
|
||||
}
|
||||
}
|
||||
|
@ -70,14 +70,18 @@ class CustomLocationActivity : AppCompatActivity() {
|
||||
|
||||
location.addTextChangedListener(object: TextWatcher {
|
||||
override fun afterTextChanged(text: Editable?) {
|
||||
Thread().run {
|
||||
val coder = Geocoder(this@CustomLocationActivity)
|
||||
try {
|
||||
val addresses = coder.getFromLocationName(text.toString(), 10) as ArrayList<Address>
|
||||
EventBus.getDefault().post(CustomLocationEvent(addresses))
|
||||
} catch (ignored: Exception) {
|
||||
EventBus.getDefault().post(CustomLocationEvent(ArrayList<Address>()))
|
||||
if (text != null && !text.equals("")) {
|
||||
Thread().run {
|
||||
val coder = Geocoder(this@CustomLocationActivity)
|
||||
try {
|
||||
val addresses = coder.getFromLocationName(text.toString(), 10) as ArrayList<Address>
|
||||
EventBus.getDefault().post(CustomLocationEvent(addresses))
|
||||
} catch (ignored: Exception) {
|
||||
EventBus.getDefault().post(CustomLocationEvent(ArrayList<Address>()))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
EventBus.getDefault().post(CustomLocationEvent(ArrayList<Address>()))
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user