adding some recording adapter improvements
This commit is contained in:
parent
158970673e
commit
61a89472e3
|
@ -191,12 +191,13 @@ class RecordingsAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun doDeleteAnimation(oldRecordingIndex: Int, recordingsToRemove: ArrayList<Recording>, positions: ArrayList<Int>) {
|
private fun doDeleteAnimation(oldRecordingIndex: Int, recordingsToRemove: ArrayList<Recording>, positions: ArrayList<Int>) {
|
||||||
recordings.removeAll(recordingsToRemove)
|
recordings.removeAll(recordingsToRemove.toSet())
|
||||||
activity.runOnUiThread {
|
activity.runOnUiThread {
|
||||||
if (recordings.isEmpty()) {
|
if (recordings.isEmpty()) {
|
||||||
refreshListener.refreshRecordings()
|
refreshListener.refreshRecordings()
|
||||||
finishActMode()
|
finishActMode()
|
||||||
} else {
|
} else {
|
||||||
|
positions.sortDescending()
|
||||||
removeSelectedItems(positions)
|
removeSelectedItems(positions)
|
||||||
if (recordingsToRemove.map { it.id }.contains(currRecordingId)) {
|
if (recordingsToRemove.map { it.id }.contains(currRecordingId)) {
|
||||||
val newRecordingIndex = Math.min(oldRecordingIndex, recordings.size - 1)
|
val newRecordingIndex = Math.min(oldRecordingIndex, recordings.size - 1)
|
||||||
|
@ -247,6 +248,11 @@ class RecordingsAdapter(
|
||||||
override fun onChange(position: Int) = recordings.getOrNull(position)?.title ?: ""
|
override fun onChange(position: Int) = recordings.getOrNull(position)?.title ?: ""
|
||||||
|
|
||||||
private fun showPopupMenu(view: View, recording: Recording) {
|
private fun showPopupMenu(view: View, recording: Recording) {
|
||||||
|
if (selectedKeys.isNotEmpty()) {
|
||||||
|
selectedKeys.clear()
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
|
||||||
finishActMode()
|
finishActMode()
|
||||||
val theme = activity.getPopupMenuTheme()
|
val theme = activity.getPopupMenuTheme()
|
||||||
val contextTheme = ContextThemeWrapper(activity, theme)
|
val contextTheme = ContextThemeWrapper(activity, theme)
|
||||||
|
|
Loading…
Reference in New Issue