fix #10, allow directly sharing recordings

This commit is contained in:
tibbi 2020-05-20 23:19:27 +02:00
parent 8c58532e62
commit 674ea18fc5
3 changed files with 17 additions and 4 deletions

View File

@ -57,7 +57,7 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.28.14'
implementation 'com.simplemobiletools:commons:5.28.15'
implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'com.github.Armen101:AudioRecordView:1.0.2'
}

View File

@ -13,9 +13,11 @@ import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.helpers.isQPlus
import com.simplemobiletools.commons.views.FastScroller
import com.simplemobiletools.commons.views.MyRecyclerView
import com.simplemobiletools.voicerecorder.BuildConfig
import com.simplemobiletools.voicerecorder.R
import com.simplemobiletools.voicerecorder.activities.SimpleActivity
import com.simplemobiletools.voicerecorder.dialogs.RenameRecordingDialog
import com.simplemobiletools.voicerecorder.helpers.getAudioFileContentUri
import com.simplemobiletools.voicerecorder.interfaces.RefreshRecordingsListener
import com.simplemobiletools.voicerecorder.models.Recording
import kotlinx.android.synthetic.main.item_recording.view.*
@ -47,6 +49,7 @@ class RecordingsAdapter(activity: SimpleActivity, var recordings: ArrayList<Reco
when (id) {
R.id.cab_rename -> renameRecording()
R.id.cab_share -> shareRecordings()
R.id.cab_select_all -> selectAll()
R.id.cab_delete -> askConfirmDelete()
}
@ -95,6 +98,11 @@ class RecordingsAdapter(activity: SimpleActivity, var recordings: ArrayList<Reco
}
}
private fun shareRecordings() {
val paths = getSelectedItems().map { getAudioFileContentUri(it.id.toLong()).toString() }
activity.sharePathsIntent(paths, BuildConfig.APPLICATION_ID)
}
private fun askConfirmDelete() {
val itemsCnt = selectedKeys.size
val firstItem = getSelectedItems().first()

View File

@ -7,13 +7,18 @@
android:title="@string/rename"
app:showAsAction="ifRoom" />
<item
android:id="@+id/cab_select_all"
android:icon="@drawable/ic_select_all_vector"
android:title="@string/select_all"
android:id="@+id/cab_share"
android:icon="@drawable/ic_share_vector"
android:title="@string/share"
app:showAsAction="ifRoom" />
<item
android:id="@+id/cab_delete"
android:icon="@drawable/ic_delete_vector"
android:title="@string/delete"
app:showAsAction="ifRoom" />
<item
android:id="@+id/cab_select_all"
android:icon="@drawable/ic_select_all_vector"
android:title="@string/select_all"
app:showAsAction="ifRoom" />
</menu>