From d13d87eb18aecf6454fbeac7e3710515205568aa Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 1 Apr 2020 19:23:29 +0200 Subject: [PATCH] mark the currently playing recording at the list --- .../adapters/RecordingsAdapter.kt | 23 +++++++++++++++---- .../voicerecorder/fragments/PlayerFragment.kt | 3 +-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/voicerecorder/adapters/RecordingsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/voicerecorder/adapters/RecordingsAdapter.kt index ca7bfff..21b7eb7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/voicerecorder/adapters/RecordingsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/voicerecorder/adapters/RecordingsAdapter.kt @@ -7,6 +7,7 @@ import android.widget.TextView import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter import com.simplemobiletools.commons.extensions.formatDate import com.simplemobiletools.commons.extensions.formatSize +import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor import com.simplemobiletools.commons.extensions.getFormattedDuration import com.simplemobiletools.commons.views.FastScroller import com.simplemobiletools.commons.views.MyRecyclerView @@ -18,6 +19,7 @@ import java.util.* class RecordingsAdapter(activity: SimpleActivity, var recordings: ArrayList, recyclerView: MyRecyclerView, fastScroller: FastScroller, itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) { + var currRecordingId = 0 init { setupDragListener(true) @@ -53,18 +55,29 @@ class RecordingsAdapter(activity: SimpleActivity, var recordings: ArrayList(recording_title, recording_date, recording_duration, recording_size).forEach { it.setTextColor(textColor) } + + if (recording.id == currRecordingId) { + recording_title.setTextColor(context.getAdjustedPrimaryColor()) + } + + recording_title.text = recording.title + recording_date.text = recording.timestamp.formatDate(context) + recording_duration.text = recording.duration.getFormattedDuration() + recording_size.text = recording.size.formatSize() } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/voicerecorder/fragments/PlayerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/voicerecorder/fragments/PlayerFragment.kt index 09ccb7e..7501b0b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/voicerecorder/fragments/PlayerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/voicerecorder/fragments/PlayerFragment.kt @@ -11,10 +11,8 @@ import android.os.Looper import android.os.PowerManager import android.provider.MediaStore import android.util.AttributeSet -import android.util.Log import android.widget.SeekBar import com.simplemobiletools.commons.extensions.* -import com.simplemobiletools.commons.helpers.isOnMainThread import com.simplemobiletools.voicerecorder.R import com.simplemobiletools.voicerecorder.activities.SimpleActivity import com.simplemobiletools.voicerecorder.adapters.RecordingsAdapter @@ -144,6 +142,7 @@ class PlayerFragment(context: Context, attributeSet: AttributeSet) : MyViewPager player_progressbar.max = recording.duration player_title.text = recording.title player_progress_max.text = recording.duration.getFormattedDuration() + (recordings_list.adapter as RecordingsAdapter).updateCurrentRecording(recording.id) player!!.apply { reset()