Fixed import/export message to show Storage Access Framework selected path.

This commit is contained in:
Dennis Guse
2019-12-29 23:33:10 +01:00
parent 36d0f17953
commit 0806821b5f
4 changed files with 14 additions and 19 deletions
@@ -20,6 +20,8 @@ import android.content.Intent;
import android.net.Uri;
import android.os.Environment;
import androidx.documentfile.provider.DocumentFile;
import java.io.File;
import de.dennisguse.opentracks.BuildConfig;
@@ -57,20 +59,15 @@ public class FileUtils {
return photoDirectory;
}
/**
* Gets the display name for a path on the external storage.
*
* @param components the components
*/
public static String getPathDisplayName(String... components) {
StringBuilder dirNameBuilder = new StringBuilder();
dirNameBuilder.append(File.separatorChar);
dirNameBuilder.append(EXPORT_DIR);
for (String component : components) {
dirNameBuilder.append(File.separatorChar);
dirNameBuilder.append(component);
public static String getPath(DocumentFile file) {
if (file == null) {
return "";
}
return dirNameBuilder.toString();
if (file.getParentFile() == null) {
return file.getName();
}
return getPath(file.getParentFile()) + File.pathSeparatorChar + file.getName();
}
/**