diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java index d46ec3f7d..19aac4f37 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java @@ -127,7 +127,7 @@ public class MediaActivity extends SimpleActivity mGridView.setOnTouchListener(this); mIsSnackbarShown = false; - final String dirName = Utils.Companion.getFilename(mPath); + final String dirName = Utils.Companion.getFilename(this, mPath); setTitle(dirName); } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/Utils.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/Utils.kt index 3296f92a0..cf05cff6d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/Utils.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/Utils.kt @@ -21,12 +21,13 @@ import java.util.* class Utils { companion object { - fun getFilename(path: String) = path.substring(path.lastIndexOf("/") + 1) - - fun showToast(context: Context, resId: Int) { - context.toast(resId) + fun getFilename(context: Context, path: String): String { + val humanized = context.humanizePath(path) + return humanized.substring(humanized.lastIndexOf("/") + 1) } + fun showToast(context: Context, resId: Int) = context.toast(resId) + fun getActionBarHeight(context: Context, res: Resources): Int { val tv = TypedValue() var height = 0 diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index 1578af556..a890a9c65 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -63,7 +63,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va directory.mediaCnt = newImageCnt directory.addSize(file.length()) } else if (!mToBeDeleted.contains(parentDir)) { - var dirName = Utils.getFilename(parentDir) + var dirName = Utils.getFilename(context, parentDir) if (mConfig.getIsFolderHidden(parentDir)) { dirName += " ${context.resources.getString(R.string.hidden)}" }