Moved the tag editors album cover folder.
This commit is contained in:
parent
ffa329d978
commit
c7b2111115
3 changed files with 14 additions and 12 deletions
|
|
@ -298,7 +298,7 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
|||
File albumArtFile = null;
|
||||
if (info.artworkInfo != null && info.artworkInfo.artwork != null) {
|
||||
try {
|
||||
albumArtFile = MusicUtil.createAlbumArtFile(String.valueOf(info.artworkInfo.albumId)).getCanonicalFile();
|
||||
albumArtFile = MusicUtil.createAlbumArtFile().getCanonicalFile();
|
||||
info.artworkInfo.artwork.compress(Bitmap.CompressFormat.PNG, 0, new FileOutputStream(albumArtFile));
|
||||
artwork = ArtworkFactory.createArtworkFromFile(albumArtFile);
|
||||
} catch (IOException e) {
|
||||
|
|
|
|||
|
|
@ -273,15 +273,17 @@ public class FoldersFragment extends AbsMainActivityFragment implements MainActi
|
|||
}
|
||||
|
||||
public static File getDefaultStartDirectory() {
|
||||
File externalStorageDir = Environment.getExternalStorageDirectory();
|
||||
File musicFolder = new File(externalStorageDir, "Music");
|
||||
File musicDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC);
|
||||
File startFolder;
|
||||
if (musicFolder.exists() && musicFolder.isDirectory()) {
|
||||
startFolder = musicFolder;
|
||||
} else if (externalStorageDir.exists() && externalStorageDir.isDirectory()) {
|
||||
startFolder = externalStorageDir;
|
||||
if (musicDir.exists() && musicDir.isDirectory()) {
|
||||
startFolder = musicDir;
|
||||
} else {
|
||||
startFolder = new File("/"); // root
|
||||
File externalStorage = Environment.getExternalStorageDirectory();
|
||||
if (externalStorage.exists() && externalStorage.isDirectory()) {
|
||||
startFolder = externalStorage;
|
||||
} else {
|
||||
startFolder = new File("/"); // root
|
||||
}
|
||||
}
|
||||
return startFolder;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,20 +127,20 @@ public class MusicUtil {
|
|||
}
|
||||
|
||||
@NonNull
|
||||
public static File createAlbumArtFile(String name) {
|
||||
return new File(createAlbumArtDir(), name + System.currentTimeMillis());
|
||||
public static File createAlbumArtFile() {
|
||||
return new File(createAlbumArtDir(), String.valueOf(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
public static File createAlbumArtDir() {
|
||||
File albumArtDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "/.albumart/");
|
||||
File albumArtDir = new File(Environment.getExternalStorageDirectory(), "/albumthumbs/");
|
||||
if (!albumArtDir.exists()) {
|
||||
albumArtDir.mkdirs();
|
||||
try {
|
||||
new File(albumArtDir, ".nomedia").createNewFile();
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "error while creating .nomedia file", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return albumArtDir;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue