Inlined getFeedPlaybackSpeed method on FeedItem

This commit is contained in:
Jonas Kalderstam 2019-09-13 23:27:55 +02:00
parent 3bcb368bb3
commit d0f19a2b14
4 changed files with 10 additions and 14 deletions

View File

@ -600,7 +600,11 @@ public class QueueFragment extends Fragment {
if(queue.size() > 0) {
long timeLeft = 0;
for(FeedItem item : queue) {
float playbackSpeed = item.getFeedPlaybackSpeed();
float playbackSpeed = SPEED_USE_GLOBAL;
Feed feed = item.getFeed();
if (feed != null) {
playbackSpeed = feed.getPreferences().getCurrentPlaybackSpeed();
}
if (playbackSpeed == SPEED_USE_GLOBAL) {
playbackSpeed = UserPreferences.getPlaybackSpeed();
}

View File

@ -486,15 +486,4 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, ImageR
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
/**
*
* @return playback speed for this feed, or the global setting if no feed-specific setting
*/
public float getFeedPlaybackSpeed() {
Feed feed = getFeed();
if (feed != null) {
return feed.getPreferences().getCurrentPlaybackSpeed();
}
return SPEED_USE_GLOBAL;
}
}

View File

@ -650,7 +650,10 @@ public class FeedMedia extends FeedFile implements Playable {
if (playbackSpeed == LAST_PLAYBACK_SPEED_UNSET) {
FeedItem item = getItem();
if (item != null) {
playbackSpeed = item.getFeedPlaybackSpeed();
Feed feed = item.getFeed();
if (feed != null) {
playbackSpeed = feed.getPreferences().getCurrentPlaybackSpeed();
}
}
}

View File

@ -182,7 +182,7 @@ public class FeedPreferences {
this.password = password;
}
float getCurrentPlaybackSpeed() {
public float getCurrentPlaybackSpeed() {
float speed = 0.0f;
if (!"global".equals(feedPlaybackSpeed)) {