Search in sources :

Example 1 with BookFormat

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();
}
Also used : BookName(com.orgzly.android.BookName) BookFormat(com.orgzly.android.BookFormat)

Aggregations

BookFormat (com.orgzly.android.BookFormat)1 BookName (com.orgzly.android.BookName)1