Fixed rating from notification
This commit is contained in:
parent
ab624be93d
commit
99dbf236c9
|
@ -1660,32 +1660,9 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
|
|||
private void setSongRating(final int rating)
|
||||
{
|
||||
if (currentSong == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String id = currentSong.getId();
|
||||
|
||||
currentSong.setUserRating(rating);
|
||||
displaySongRating();
|
||||
getDownloadService().updateNotification();
|
||||
|
||||
new Thread(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
final MusicService musicService = MusicServiceFactory.getMusicService(DownloadActivity.this);
|
||||
|
||||
try
|
||||
{
|
||||
musicService.setRating(id, rating, DownloadActivity.this, null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.e(TAG, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
getDownloadService().setSongRating(rating);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,4 +146,6 @@ public interface DownloadService
|
|||
void startJukeboxService();
|
||||
|
||||
void updateNotification();
|
||||
|
||||
void setSongRating(final int rating);
|
||||
}
|
||||
|
|
|
@ -2159,12 +2159,33 @@ public class DownloadServiceImpl extends Service implements DownloadService
|
|||
|
||||
public void setSongRating(final int rating)
|
||||
{
|
||||
if (!new FeatureStorage(this).isFeatureEnabled(Feature.FIVE_STAR_RATING))
|
||||
if (!KoinJavaComponent.get(FeatureStorage.class).isFeatureEnabled(Feature.FIVE_STAR_RATING))
|
||||
return;
|
||||
|
||||
if (currentPlaying == null)
|
||||
return;
|
||||
|
||||
final Entry song = currentPlaying.getSong();
|
||||
song.setUserRating(rating);
|
||||
|
||||
new Thread(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
final MusicService musicService = MusicServiceFactory.getMusicService(DownloadServiceImpl.this);
|
||||
|
||||
try
|
||||
{
|
||||
musicService.setRating(song.getId(), rating, DownloadServiceImpl.this, null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.e(TAG, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
updateNotification();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue