Fixed rating from notification

This commit is contained in:
Nite 2020-02-23 12:57:15 +01:00
parent ab624be93d
commit 99dbf236c9
No known key found for this signature in database
GPG Key ID: 1D1AD59B1C6386C1
3 changed files with 25 additions and 25 deletions

View File

@ -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);
}
}

View File

@ -146,4 +146,6 @@ public interface DownloadService
void startJukeboxService();
void updateNotification();
void setSongRating(final int rating);
}

View File

@ -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();
}