Skip to content

Commit 7bd7f40

Browse files
committed
Readability improvements
1 parent 117438b commit 7bd7f40

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/TracksActivity.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,10 @@ class TracksActivity : SimpleActivity() {
360360
}
361361

362362
private fun onSearchQueryChanged(text: String) {
363-
val filtered = tracksIgnoringSearch.filter { it.title.contains(text, true) || ( it.artist + " - " + it.album ).contains(text, true) }.toMutableList() as ArrayList<Track>
363+
val filtered = tracksIgnoringSearch.filter {
364+
it.title.contains(text, true) ||
365+
(it.artist + " - " + it.album).contains(text, true)
366+
}.toMutableList() as ArrayList<Track>
364367
(tracks_list.adapter as? TracksAdapter)?.updateItems(filtered, text)
365368
tracks_placeholder.beGoneIf(filtered.isNotEmpty())
366369
}

app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/TracksAdapter.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,11 @@ class TracksAdapter(
209209
view.apply {
210210
track_frame?.isSelected = selectedKeys.contains(track.hashCode())
211211
track_title.text = if (textToHighlight.isEmpty()) track.title else track.title.highlightTextPart(textToHighlight, properPrimaryColor)
212-
track_info.text = if (textToHighlight.isEmpty()) track.artist + " - " + track.album else ( track.artist + " - " + track.album ).highlightTextPart(textToHighlight, properPrimaryColor)
212+
track_info.text = if (textToHighlight.isEmpty()) {
213+
track.artist + " - " + track.album
214+
} else {
215+
( track.artist + " - " + track.album ).highlightTextPart(textToHighlight, properPrimaryColor)
216+
}
213217
track_drag_handle.beVisibleIf(isPlaylistContent && selectedKeys.isNotEmpty())
214218
track_drag_handle.applyColorFilter(textColor)
215219
track_drag_handle.setOnTouchListener { v, event ->

app/src/main/kotlin/com/simplemobiletools/musicplayer/fragments/TracksFragment.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ class TracksFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
8888
}
8989

9090
override fun onSearchQueryChanged(text: String) {
91-
val filtered = tracksIgnoringSearch.filter { it.title.contains(text, true) || ( it.artist + " - " + it.album ).contains(text, true) }.toMutableList() as ArrayList<Track>
91+
val filtered = tracksIgnoringSearch.filter {
92+
it.title.contains(text, true) ||
93+
( it.artist + " - " + it.album ).contains(text, true)
94+
}.toMutableList() as ArrayList<Track>
9295
(tracks_list.adapter as? TracksAdapter)?.updateItems(filtered, text)
9396
tracks_placeholder.beVisibleIf(filtered.isEmpty())
9497
}

0 commit comments

Comments
 (0)