@@ -62,8 +62,8 @@ class AdapterAppChooser(
6262 }
6363
6464 override fun performFiltering (constraint : CharSequence? ): FilterResults {
65- val results = Filter . FilterResults ()
66- val prefix: String = if ( constraint == null ) " " else constraint .toString()
65+ val results = FilterResults ()
66+ val prefix: String = constraint? .toString() ? : " "
6767
6868 if (prefix.isEmpty()) {
6969 val list: ArrayList <AppInfo >
@@ -141,14 +141,9 @@ class AdapterAppChooser(
141141 val installInfo = context.packageManager.getPackageInfo(packageName, 0 )
142142 iconCaches.put(
143143 packageName,
144- installInfo.applicationInfo?.let {
145- iconCaches.put(
146- packageName,
147- it.loadIcon(context.packageManager)
148- )
149- }
144+ installInfo.applicationInfo?.loadIcon(context.packageManager)
150145 )
151- } catch (ex : Exception ) {
146+ } catch (_ : Exception ) {
152147 app.notFound = true
153148 } finally {
154149 }
@@ -177,12 +172,12 @@ class AdapterAppChooser(
177172 val visibleFirstPosi = listView.firstVisiblePosition
178173 val visibleLastPosi = listView.lastVisiblePosition
179174
180- if (position >= visibleFirstPosi && position <= visibleLastPosi) {
175+ if (position in visibleFirstPosi.. visibleLastPosi) {
181176 filterApps[position] = AppInfo
182177 val view = listView.getChildAt(position - visibleFirstPosi)
183178 updateRow(position, view)
184179 }
185- } catch (ex : Exception ) {
180+ } catch (_ : Exception ) {
186181 }
187182 }
188183
@@ -249,7 +244,7 @@ class AdapterAppChooser(
249244 return apps.filter { it.selected }
250245 }
251246
252- inner class ViewHolder {
247+ class ViewHolder {
253248 internal var packageName: String? = null
254249
255250 internal var itemTitle: TextView ? = null
0 commit comments