check storage permission before getting latest media id

This commit is contained in:
tibbi 2018-02-20 19:27:31 +01:00
parent 6976c35ee4
commit c271822844

View file

@ -17,6 +17,7 @@ import com.simplemobiletools.commons.dialogs.CreateNewFolderDialog
import com.simplemobiletools.commons.dialogs.FilePickerDialog
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.PERMISSION_READ_STORAGE
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
import com.simplemobiletools.commons.helpers.SORT_BY_DATE_MODIFIED
import com.simplemobiletools.commons.helpers.SORT_BY_DATE_TAKEN
@ -634,7 +635,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
private fun setupLatestMediaId() {
Thread {
mLatestMediaId = getLatestMediaId()
if (hasPermission(PERMISSION_READ_STORAGE)) {
mLatestMediaId = getLatestMediaId()
}
}.start()
}