Search in sources :

Example 1 with SongExtKt

use of com.simplecity.amp_library.utils.extensions.SongExtKt in project Shuttle by timusus.

the class DeleteDialog method deleteSongs.

@SuppressLint("CheckResult")
Single<Integer> deleteSongs() {
    return Single.fromCallable(() -> {
        int deletedSongs = 0;
        if (!documentFilesForDeletion.isEmpty()) {
            deletedSongs += Stream.of(documentFilesForDeletion).filter(DocumentFile::delete).count();
            tidyUp(songsForSafDeletion);
            documentFilesForDeletion.clear();
            songsForSafDeletion.clear();
        }
        if (!songsForNormalDeletion.isEmpty()) {
            deletedSongs += Stream.of(songsForNormalDeletion).filter(SongExtKt::delete).count();
            tidyUp(songsForNormalDeletion);
            songsForNormalDeletion.clear();
        }
        return deletedSongs;
    });
}
Also used : DocumentFile(android.support.v4.provider.DocumentFile) SongExtKt(com.simplecity.amp_library.utils.extensions.SongExtKt) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)1 DocumentFile (android.support.v4.provider.DocumentFile)1 SongExtKt (com.simplecity.amp_library.utils.extensions.SongExtKt)1