use of com.orgzly.android.BookFormat in project orgzly-android by orgzly.
the class UriUtils method getUriForNewName.
/**
* Replaces the name part of the uri, leaving everything (including the extension) the same.
*/
public static Uri getUriForNewName(Uri uri, String name) {
BookName bookName = BookName.fromFileName(uri.getLastPathSegment());
BookFormat format = bookName.getFormat();
String newFilename = BookName.fileName(name, format);
return // Old Uri without file name
UriUtils.dirUri(uri).buildUpon().appendPath(// New file name
newFilename).build();
}
Aggregations