Improve image quality with server-side scaling, catch async exceptions
This commit is contained in:
parent
98ca08badd
commit
f68daaf09d
|
@ -2,8 +2,8 @@
|
||||||
<manifest xmlns:a="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:a="http://schemas.android.com/apk/res/android"
|
||||||
package="com.thejoshwa.ultrasonic.androidapp"
|
package="com.thejoshwa.ultrasonic.androidapp"
|
||||||
a:installLocation="auto"
|
a:installLocation="auto"
|
||||||
a:versionCode="39"
|
a:versionCode="40"
|
||||||
a:versionName="1.2.0.12" >
|
a:versionName="1.2.0.13" >
|
||||||
|
|
||||||
<uses-permission a:name="android.permission.INTERNET" />
|
<uses-permission a:name="android.permission.INTERNET" />
|
||||||
<uses-permission a:name="android.permission.READ_PHONE_STATE" />
|
<uses-permission a:name="android.permission.READ_PHONE_STATE" />
|
||||||
|
|
|
@ -965,7 +965,7 @@ public class SelectAlbumActivity extends SubsonicTabActivity
|
||||||
{
|
{
|
||||||
ImageView coverArtView = (ImageView) header.findViewById(R.id.select_album_art);
|
ImageView coverArtView = (ImageView) header.findViewById(R.id.select_album_art);
|
||||||
int artworkSelection = random.nextInt(entries.size());
|
int artworkSelection = random.nextInt(entries.size());
|
||||||
getImageLoader().loadImage(coverArtView, entries.get(artworkSelection), true, Util.getAlbumImageSize(SelectAlbumActivity.this), false, true);
|
getImageLoader().loadImage(coverArtView, entries.get(artworkSelection), false, Util.getAlbumImageSize(SelectAlbumActivity.this), false, true);
|
||||||
|
|
||||||
TextView titleView = (TextView) header.findViewById(R.id.select_album_title);
|
TextView titleView = (TextView) header.findViewById(R.id.select_album_title);
|
||||||
titleView.setText(name != null ? name : getActionBarSubtitle());
|
titleView.setText(name != null ? name : getActionBarSubtitle());
|
||||||
|
|
|
@ -489,7 +489,7 @@ public class SubsonicTabActivity extends Activity implements OnClickListener
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
getImageLoader().loadImage(nowPlayingAlbumArtImage, song, true, Util.getNotificationImageSize(context), false, true);
|
getImageLoader().loadImage(nowPlayingAlbumArtImage, song, false, Util.getNotificationImageSize(context), false, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -922,22 +922,6 @@ public class RESTMusicService implements MusicService
|
||||||
|
|
||||||
byte[] bytes = Util.toByteArray(in);
|
byte[] bytes = Util.toByteArray(in);
|
||||||
|
|
||||||
File albumDir = FileUtil.getAlbumDirectory(context, entry);
|
|
||||||
|
|
||||||
if (albumDir.exists())
|
|
||||||
{
|
|
||||||
OutputStream out = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
out = new FileOutputStream(FileUtil.getAlbumArtFile(albumDir));
|
|
||||||
out.write(bytes);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Util.close(out);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we aren't allowing server-side scaling, always save the file to disk because it will be unmodified
|
// If we aren't allowing server-side scaling, always save the file to disk because it will be unmodified
|
||||||
if (!serverScaling || saveToFile)
|
if (!serverScaling || saveToFile)
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,17 +40,41 @@ public class CacheCleaner
|
||||||
|
|
||||||
public void clean()
|
public void clean()
|
||||||
{
|
{
|
||||||
new BackgroundCleanup().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
try
|
||||||
|
{
|
||||||
|
new BackgroundCleanup().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// If an exception is thrown, assume we execute correctly the next time
|
||||||
|
Log.w("Exception in CacheCleaner.clean", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cleanSpace()
|
public void cleanSpace()
|
||||||
{
|
{
|
||||||
new BackgroundSpaceCleanup().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
try
|
||||||
|
{
|
||||||
|
new BackgroundSpaceCleanup().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// If an exception is thrown, assume we execute correctly the next time
|
||||||
|
Log.w("Exception in CacheCleaner.cleanSpace", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cleanPlaylists(List<Playlist> playlists)
|
public void cleanPlaylists(List<Playlist> playlists)
|
||||||
{
|
{
|
||||||
new BackgroundPlaylistsCleanup().execute(playlists);
|
try
|
||||||
|
{
|
||||||
|
new BackgroundPlaylistsCleanup().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, playlists);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// If an exception is thrown, assume we execute correctly the next time
|
||||||
|
Log.w("Exception in CacheCleaner.cleanPlaylists", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void deleteEmptyDirs(Iterable<File> dirs, Collection<File> undeletable)
|
private static void deleteEmptyDirs(Iterable<File> dirs, Collection<File> undeletable)
|
||||||
|
|
Loading…
Reference in New Issue