use proper actionbar title at OTG folders
This commit is contained in:
parent
d5496e04ba
commit
55fa9a04d5
2 changed files with 7 additions and 2 deletions
|
@ -24,6 +24,7 @@ import com.google.gson.Gson
|
||||||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
||||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
|
import com.simplemobiletools.commons.helpers.OTG_PATH
|
||||||
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
|
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
|
||||||
import com.simplemobiletools.commons.helpers.REQUEST_EDIT_IMAGE
|
import com.simplemobiletools.commons.helpers.REQUEST_EDIT_IMAGE
|
||||||
import com.simplemobiletools.commons.models.FileDirItem
|
import com.simplemobiletools.commons.models.FileDirItem
|
||||||
|
@ -278,7 +279,11 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
private fun tryloadGallery() {
|
private fun tryloadGallery() {
|
||||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||||
if (it) {
|
if (it) {
|
||||||
val dirName = getHumanizedFilename(mPath)
|
val dirName = when {
|
||||||
|
mPath == OTG_PATH -> getString(R.string.otg)
|
||||||
|
mPath.startsWith(OTG_PATH) -> mPath.trimEnd('/').substringAfterLast('/')
|
||||||
|
else -> getHumanizedFilename(mPath)
|
||||||
|
}
|
||||||
supportActionBar?.title = if (mShowAll) resources.getString(R.string.all_folders) else dirName
|
supportActionBar?.title = if (mShowAll) resources.getString(R.string.all_folders) else dirName
|
||||||
getMedia()
|
getMedia()
|
||||||
setupLayoutManager()
|
setupLayoutManager()
|
||||||
|
|
|
@ -51,7 +51,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
|
||||||
OTG_PATH -> context.getString(R.string.otg)
|
OTG_PATH -> context.getString(R.string.otg)
|
||||||
else -> {
|
else -> {
|
||||||
if (parentDir.startsWith(OTG_PATH)) {
|
if (parentDir.startsWith(OTG_PATH)) {
|
||||||
parentDir.getParentPath().trimEnd('/').substringAfterLast('/')
|
parentDir.trimEnd('/').substringAfterLast('/')
|
||||||
} else {
|
} else {
|
||||||
parentDir.getFilenameFromPath()
|
parentDir.getFilenameFromPath()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue