display proper directory names at storage root folders

This commit is contained in:
tibbi 2016-11-13 11:17:01 +01:00
parent 4d324e491e
commit 09231c516c
3 changed files with 7 additions and 6 deletions

View file

@ -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);
}

View file

@ -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

View file

@ -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)}"
}