Changed type of media last playback speed to float from string
Also sets default to "magic" -1 value
This commit is contained in:
parent
00c1e7a3d3
commit
4746b16b12
@ -152,7 +152,11 @@ public class AudioplayerActivity extends MediaplayerInfoActivity {
|
|||||||
private void storeNewMediaPlaybackSpeed(String speed) {
|
private void storeNewMediaPlaybackSpeed(String speed) {
|
||||||
Playable media = controller.getMedia();
|
Playable media = controller.getMedia();
|
||||||
if (media instanceof FeedMedia) {
|
if (media instanceof FeedMedia) {
|
||||||
((FeedMedia) media).updateLastPlaybackSpeed(speed);
|
try {
|
||||||
|
((FeedMedia) media).updateLastPlaybackSpeed(Float.parseFloat(speed));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// Well this was awkward...
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
|||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
|
||||||
|
import static de.danoeh.antennapod.core.feed.FeedPreferences.SPEED_USE_GLOBAL;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides general features which are both needed for playing audio and video
|
* Provides general features which are both needed for playing audio and video
|
||||||
@ -873,16 +875,21 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected float getPlaybackSpeedForMedia() {
|
float getPlaybackSpeedForMedia() {
|
||||||
|
float playbackSpeed = SPEED_USE_GLOBAL;
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
Playable media = controller.getMedia();
|
Playable media = controller.getMedia();
|
||||||
boolean isFeedMedia = media instanceof FeedMedia;
|
boolean isFeedMedia = media instanceof FeedMedia;
|
||||||
|
|
||||||
if (isFeedMedia) {
|
if (isFeedMedia) {
|
||||||
return ((FeedMedia) media).getMediaPlaybackSpeed();
|
playbackSpeed = ((FeedMedia) media).getMediaPlaybackSpeed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return UserPreferences.getPlaybackSpeed();
|
if (playbackSpeed == SPEED_USE_GLOBAL) {
|
||||||
|
playbackSpeed = UserPreferences.getPlaybackSpeed();
|
||||||
|
}
|
||||||
|
|
||||||
|
return playbackSpeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@ import de.danoeh.antennapod.core.util.Converter;
|
|||||||
import de.danoeh.antennapod.core.util.playback.Playable;
|
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||||
import de.danoeh.antennapod.core.util.playback.PlaybackController;
|
import de.danoeh.antennapod.core.util.playback.PlaybackController;
|
||||||
|
|
||||||
|
import static de.danoeh.antennapod.core.feed.FeedPreferences.SPEED_USE_GLOBAL;
|
||||||
|
|
||||||
public class PlaybackControlsDialog extends DialogFragment {
|
public class PlaybackControlsDialog extends DialogFragment {
|
||||||
private static final float PLAYBACK_SPEED_STEP = 0.05f;
|
private static final float PLAYBACK_SPEED_STEP = 0.05f;
|
||||||
private static final float DEFAULT_MIN_PLAYBACK_SPEED = 0.5f;
|
private static final float DEFAULT_MIN_PLAYBACK_SPEED = 0.5f;
|
||||||
@ -214,15 +216,20 @@ public class PlaybackControlsDialog extends DialogFragment {
|
|||||||
return UserPreferences.getVideoPlaybackSpeed();
|
return UserPreferences.getVideoPlaybackSpeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float playbackSpeed = SPEED_USE_GLOBAL;
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
Playable media = controller.getMedia();
|
Playable media = controller.getMedia();
|
||||||
boolean isFeedMedia = media instanceof FeedMedia;
|
boolean isFeedMedia = media instanceof FeedMedia;
|
||||||
|
|
||||||
if (isFeedMedia) {
|
if (isFeedMedia) {
|
||||||
return ((FeedMedia) media).getMediaPlaybackSpeed();
|
playbackSpeed = ((FeedMedia) media).getMediaPlaybackSpeed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return UserPreferences.getPlaybackSpeed();
|
if (playbackSpeed == SPEED_USE_GLOBAL) {
|
||||||
|
playbackSpeed = UserPreferences.getPlaybackSpeed();
|
||||||
|
}
|
||||||
|
|
||||||
|
return playbackSpeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,7 @@ import org.greenrobot.eventbus.EventBus;
|
|||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
|
import static de.danoeh.antennapod.core.feed.FeedPreferences.SPEED_USE_GLOBAL;
|
||||||
import static de.danoeh.antennapod.dialog.EpisodesApplyActionFragment.ACTION_DELETE;
|
import static de.danoeh.antennapod.dialog.EpisodesApplyActionFragment.ACTION_DELETE;
|
||||||
import static de.danoeh.antennapod.dialog.EpisodesApplyActionFragment.ACTION_REMOVE_FROM_QUEUE;
|
import static de.danoeh.antennapod.dialog.EpisodesApplyActionFragment.ACTION_REMOVE_FROM_QUEUE;
|
||||||
|
|
||||||
@ -600,6 +601,9 @@ public class QueueFragment extends Fragment {
|
|||||||
long timeLeft = 0;
|
long timeLeft = 0;
|
||||||
for(FeedItem item : queue) {
|
for(FeedItem item : queue) {
|
||||||
float playbackSpeed = item.getFeedPlaybackSpeed();
|
float playbackSpeed = item.getFeedPlaybackSpeed();
|
||||||
|
if (playbackSpeed == SPEED_USE_GLOBAL) {
|
||||||
|
playbackSpeed = UserPreferences.getPlaybackSpeed();
|
||||||
|
}
|
||||||
if(item.getMedia() != null) {
|
if(item.getMedia() != null) {
|
||||||
timeLeft +=
|
timeLeft +=
|
||||||
(long) ((item.getMedia().getDuration() - item.getMedia().getPosition())
|
(long) ((item.getMedia().getDuration() - item.getMedia().getPosition())
|
||||||
|
@ -20,6 +20,8 @@ import de.danoeh.antennapod.core.storage.DBReader;
|
|||||||
import de.danoeh.antennapod.core.storage.PodDBAdapter;
|
import de.danoeh.antennapod.core.storage.PodDBAdapter;
|
||||||
import de.danoeh.antennapod.core.util.ShownotesProvider;
|
import de.danoeh.antennapod.core.util.ShownotesProvider;
|
||||||
|
|
||||||
|
import static de.danoeh.antennapod.core.feed.FeedPreferences.SPEED_USE_GLOBAL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data Object for a XML message
|
* Data Object for a XML message
|
||||||
*
|
*
|
||||||
@ -493,6 +495,6 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, ImageR
|
|||||||
if (feed != null) {
|
if (feed != null) {
|
||||||
return feed.getPreferences().getCurrentPlaybackSpeed();
|
return feed.getPreferences().getCurrentPlaybackSpeed();
|
||||||
}
|
}
|
||||||
return UserPreferences.getPlaybackSpeed();
|
return SPEED_USE_GLOBAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,15 +21,18 @@ import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
|
|||||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||||
import de.danoeh.antennapod.core.service.playback.PlaybackService;
|
import de.danoeh.antennapod.core.service.playback.PlaybackService;
|
||||||
import de.danoeh.antennapod.core.storage.DBReader;
|
import de.danoeh.antennapod.core.storage.DBReader;
|
||||||
import de.danoeh.antennapod.core.storage.DBTasks;
|
|
||||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||||
import de.danoeh.antennapod.core.storage.PodDBAdapter;
|
import de.danoeh.antennapod.core.storage.PodDBAdapter;
|
||||||
import de.danoeh.antennapod.core.util.ChapterUtils;
|
import de.danoeh.antennapod.core.util.ChapterUtils;
|
||||||
import de.danoeh.antennapod.core.util.playback.Playable;
|
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||||
|
|
||||||
|
import static de.danoeh.antennapod.core.feed.FeedPreferences.SPEED_USE_GLOBAL;
|
||||||
|
|
||||||
public class FeedMedia extends FeedFile implements Playable {
|
public class FeedMedia extends FeedFile implements Playable {
|
||||||
private static final String TAG = "FeedMedia";
|
private static final String TAG = "FeedMedia";
|
||||||
|
|
||||||
|
public static final float LAST_PLAYBACK_SPEED_UNSET = SPEED_USE_GLOBAL;
|
||||||
|
|
||||||
public static final int FEEDFILETYPE_FEEDMEDIA = 2;
|
public static final int FEEDFILETYPE_FEEDMEDIA = 2;
|
||||||
public static final int PLAYABLE_TYPE_FEEDMEDIA = 1;
|
public static final int PLAYABLE_TYPE_FEEDMEDIA = 1;
|
||||||
|
|
||||||
@ -55,7 +58,7 @@ public class FeedMedia extends FeedFile implements Playable {
|
|||||||
private Date playbackCompletionDate;
|
private Date playbackCompletionDate;
|
||||||
private int startPosition = -1;
|
private int startPosition = -1;
|
||||||
private int playedDurationWhenStarted;
|
private int playedDurationWhenStarted;
|
||||||
private String lastPlaybackSpeed = null;
|
private float lastPlaybackSpeed = LAST_PLAYBACK_SPEED_UNSET;
|
||||||
|
|
||||||
// if null: unknown, will be checked
|
// if null: unknown, will be checked
|
||||||
private Boolean hasEmbeddedPicture;
|
private Boolean hasEmbeddedPicture;
|
||||||
@ -92,7 +95,7 @@ public class FeedMedia extends FeedFile implements Playable {
|
|||||||
private FeedMedia(long id, FeedItem item, int duration, int position,
|
private FeedMedia(long id, FeedItem item, int duration, int position,
|
||||||
long size, String mime_type, String file_url, String download_url,
|
long size, String mime_type, String file_url, String download_url,
|
||||||
boolean downloaded, Date playbackCompletionDate, int played_duration,
|
boolean downloaded, Date playbackCompletionDate, int played_duration,
|
||||||
Boolean hasEmbeddedPicture, long lastPlayedTime, String lastPlaybackSpeed) {
|
Boolean hasEmbeddedPicture, long lastPlayedTime, float lastPlaybackSpeed) {
|
||||||
this(id, item, duration, position, size, mime_type, file_url, download_url, downloaded,
|
this(id, item, duration, position, size, mime_type, file_url, download_url, downloaded,
|
||||||
playbackCompletionDate, played_duration, lastPlayedTime);
|
playbackCompletionDate, played_duration, lastPlayedTime);
|
||||||
this.hasEmbeddedPicture = hasEmbeddedPicture;
|
this.hasEmbeddedPicture = hasEmbeddedPicture;
|
||||||
@ -111,7 +114,7 @@ public class FeedMedia extends FeedFile implements Playable {
|
|||||||
int indexDownloaded = cursor.getColumnIndex(PodDBAdapter.KEY_DOWNLOADED);
|
int indexDownloaded = cursor.getColumnIndex(PodDBAdapter.KEY_DOWNLOADED);
|
||||||
int indexPlayedDuration = cursor.getColumnIndex(PodDBAdapter.KEY_PLAYED_DURATION);
|
int indexPlayedDuration = cursor.getColumnIndex(PodDBAdapter.KEY_PLAYED_DURATION);
|
||||||
int indexLastPlayedTime = cursor.getColumnIndex(PodDBAdapter.KEY_LAST_PLAYED_TIME);
|
int indexLastPlayedTime = cursor.getColumnIndex(PodDBAdapter.KEY_LAST_PLAYED_TIME);
|
||||||
int indexLastPlaybackSpeed = cursor.getColumnIndex(PodDBAdapter.KEY_LAST_PLAYBACK_SPEED);
|
int indexLastPlaybackSpeed = cursor.getColumnIndex(PodDBAdapter.KEY_MEDIA_LAST_PLAYBACK_SPEED);
|
||||||
|
|
||||||
long mediaId = cursor.getLong(indexId);
|
long mediaId = cursor.getLong(indexId);
|
||||||
Date playbackCompletionDate = null;
|
Date playbackCompletionDate = null;
|
||||||
@ -147,7 +150,7 @@ public class FeedMedia extends FeedFile implements Playable {
|
|||||||
cursor.getInt(indexPlayedDuration),
|
cursor.getInt(indexPlayedDuration),
|
||||||
hasEmbeddedPicture,
|
hasEmbeddedPicture,
|
||||||
cursor.getLong(indexLastPlayedTime),
|
cursor.getLong(indexLastPlayedTime),
|
||||||
cursor.getString(indexLastPlaybackSpeed)
|
cursor.getFloat(indexLastPlaybackSpeed)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -628,11 +631,11 @@ public class FeedMedia extends FeedFile implements Playable {
|
|||||||
return super.equals(o);
|
return super.equals(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLastPlaybackSpeed() {
|
public float getLastPlaybackSpeed() {
|
||||||
return lastPlaybackSpeed;
|
return lastPlaybackSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateLastPlaybackSpeed(String newSpeed) {
|
public void updateLastPlaybackSpeed(float newSpeed) {
|
||||||
lastPlaybackSpeed = newSpeed;
|
lastPlaybackSpeed = newSpeed;
|
||||||
DBWriter.setFeedMediaPlaybackInformation(this);
|
DBWriter.setFeedMediaPlaybackInformation(this);
|
||||||
}
|
}
|
||||||
@ -642,19 +645,15 @@ public class FeedMedia extends FeedFile implements Playable {
|
|||||||
* @return the current playback speed for the media, or the feed's configured speed
|
* @return the current playback speed for the media, or the feed's configured speed
|
||||||
*/
|
*/
|
||||||
public float getMediaPlaybackSpeed() {
|
public float getMediaPlaybackSpeed() {
|
||||||
if (lastPlaybackSpeed != null) {
|
float playbackSpeed = lastPlaybackSpeed;
|
||||||
try {
|
|
||||||
return Float.parseFloat(lastPlaybackSpeed);
|
if (playbackSpeed == LAST_PLAYBACK_SPEED_UNSET) {
|
||||||
} catch (NumberFormatException e) {
|
FeedItem item = getItem();
|
||||||
lastPlaybackSpeed = null;
|
if (item != null) {
|
||||||
|
playbackSpeed = item.getFeedPlaybackSpeed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FeedItem item = getItem();
|
return playbackSpeed;
|
||||||
if (item != null) {
|
|
||||||
return item.getFeedPlaybackSpeed();
|
|
||||||
}
|
|
||||||
|
|
||||||
return UserPreferences.getPlaybackSpeed();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,8 @@ import de.danoeh.antennapod.core.storage.PodDBAdapter;
|
|||||||
*/
|
*/
|
||||||
public class FeedPreferences {
|
public class FeedPreferences {
|
||||||
|
|
||||||
|
public static final float SPEED_USE_GLOBAL = -1;
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private FeedFilter filter;
|
private FeedFilter filter;
|
||||||
private long feedID;
|
private long feedID;
|
||||||
@ -180,7 +182,7 @@ public class FeedPreferences {
|
|||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getCurrentPlaybackSpeed() {
|
float getCurrentPlaybackSpeed() {
|
||||||
float speed = 0.0f;
|
float speed = 0.0f;
|
||||||
|
|
||||||
if (!"global".equals(feedPlaybackSpeed)) {
|
if (!"global".equals(feedPlaybackSpeed)) {
|
||||||
@ -193,7 +195,7 @@ public class FeedPreferences {
|
|||||||
|
|
||||||
// Either global or error happened
|
// Either global or error happened
|
||||||
if (speed == 0.0f) {
|
if (speed == 0.0f) {
|
||||||
speed = UserPreferences.getPlaybackSpeed();
|
speed = SPEED_USE_GLOBAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return speed;
|
return speed;
|
||||||
|
@ -35,6 +35,8 @@ import de.danoeh.antennapod.core.util.playback.IPlayer;
|
|||||||
import de.danoeh.antennapod.core.util.playback.Playable;
|
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||||
import de.danoeh.antennapod.core.util.playback.VideoPlayer;
|
import de.danoeh.antennapod.core.util.playback.VideoPlayer;
|
||||||
|
|
||||||
|
import static de.danoeh.antennapod.core.feed.FeedPreferences.SPEED_USE_GLOBAL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages the MediaPlayer object of the PlaybackService.
|
* Manages the MediaPlayer object of the PlaybackService.
|
||||||
*/
|
*/
|
||||||
@ -305,13 +307,18 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer {
|
|||||||
Log.d(TAG, "Audiofocus successfully requested");
|
Log.d(TAG, "Audiofocus successfully requested");
|
||||||
Log.d(TAG, "Resuming/Starting playback");
|
Log.d(TAG, "Resuming/Starting playback");
|
||||||
acquireWifiLockIfNecessary();
|
acquireWifiLockIfNecessary();
|
||||||
|
float playbackSpeed;
|
||||||
if (media.getMediaType() == MediaType.VIDEO) {
|
if (media.getMediaType() == MediaType.VIDEO) {
|
||||||
setPlaybackParams(UserPreferences.getVideoPlaybackSpeed(), UserPreferences.isSkipSilence());
|
playbackSpeed = UserPreferences.getVideoPlaybackSpeed();
|
||||||
} else if (media instanceof FeedMedia) {
|
} else if (media instanceof FeedMedia) {
|
||||||
setPlaybackParams(((FeedMedia) media).getMediaPlaybackSpeed(), UserPreferences.isSkipSilence());
|
playbackSpeed = ((FeedMedia) media).getMediaPlaybackSpeed();
|
||||||
} else {
|
} else {
|
||||||
setPlaybackParams(UserPreferences.getPlaybackSpeed(), UserPreferences.isSkipSilence());
|
playbackSpeed = SPEED_USE_GLOBAL;
|
||||||
}
|
}
|
||||||
|
if (playbackSpeed == SPEED_USE_GLOBAL) {
|
||||||
|
playbackSpeed = UserPreferences.getPlaybackSpeed();
|
||||||
|
}
|
||||||
|
setPlaybackParams(playbackSpeed, UserPreferences.isSkipSilence());
|
||||||
setVolume(UserPreferences.getLeftVolume(), UserPreferences.getRightVolume());
|
setVolume(UserPreferences.getLeftVolume(), UserPreferences.getRightVolume());
|
||||||
|
|
||||||
if (playerStatus == PlayerStatus.PREPARED && media.getPosition() > 0) {
|
if (playerStatus == PlayerStatus.PREPARED && media.getPosition() > 0) {
|
||||||
|
@ -8,6 +8,8 @@ import android.util.Log;
|
|||||||
|
|
||||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||||
|
|
||||||
|
import static de.danoeh.antennapod.core.feed.FeedMedia.LAST_PLAYBACK_SPEED_UNSET;
|
||||||
|
|
||||||
class DBUpgrader {
|
class DBUpgrader {
|
||||||
/**
|
/**
|
||||||
* Upgrades the given database to a new schema version
|
* Upgrades the given database to a new schema version
|
||||||
@ -292,7 +294,7 @@ class DBUpgrader {
|
|||||||
db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEEDS
|
db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEEDS
|
||||||
+ " ADD COLUMN " + PodDBAdapter.KEY_FEED_PLAYBACK_SPEED + " TEXT");
|
+ " ADD COLUMN " + PodDBAdapter.KEY_FEED_PLAYBACK_SPEED + " TEXT");
|
||||||
db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEED_MEDIA
|
db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEED_MEDIA
|
||||||
+ " ADD COLUMN " + PodDBAdapter.KEY_LAST_PLAYBACK_SPEED + " TEXT");
|
+ " ADD COLUMN " + PodDBAdapter.KEY_MEDIA_LAST_PLAYBACK_SPEED + " REAL DEFAULT " + LAST_PLAYBACK_SPEED_UNSET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,10 +12,7 @@ import android.database.SQLException;
|
|||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.database.sqlite.SQLiteDatabase.CursorFactory;
|
import android.database.sqlite.SQLiteDatabase.CursorFactory;
|
||||||
import android.database.sqlite.SQLiteOpenHelper;
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
import android.media.MediaMetadataRetriever;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@ -40,6 +37,8 @@ import de.danoeh.antennapod.core.service.download.DownloadStatus;
|
|||||||
import de.danoeh.antennapod.core.util.LongIntMap;
|
import de.danoeh.antennapod.core.util.LongIntMap;
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
|
import static de.danoeh.antennapod.core.feed.FeedMedia.LAST_PLAYBACK_SPEED_UNSET;
|
||||||
|
|
||||||
// TODO Remove media column from feeditem table
|
// TODO Remove media column from feeditem table
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -115,7 +114,7 @@ public class PodDBAdapter {
|
|||||||
public static final String KEY_INCLUDE_FILTER = "include_filter";
|
public static final String KEY_INCLUDE_FILTER = "include_filter";
|
||||||
public static final String KEY_EXCLUDE_FILTER = "exclude_filter";
|
public static final String KEY_EXCLUDE_FILTER = "exclude_filter";
|
||||||
public static final String KEY_FEED_PLAYBACK_SPEED = "feed_playback_speed";
|
public static final String KEY_FEED_PLAYBACK_SPEED = "feed_playback_speed";
|
||||||
public static final String KEY_LAST_PLAYBACK_SPEED = "last_playback_speed";
|
public static final String KEY_MEDIA_LAST_PLAYBACK_SPEED = "last_playback_speed";
|
||||||
|
|
||||||
// Table names
|
// Table names
|
||||||
static final String TABLE_NAME_FEEDS = "Feeds";
|
static final String TABLE_NAME_FEEDS = "Feeds";
|
||||||
@ -171,7 +170,7 @@ public class PodDBAdapter {
|
|||||||
+ KEY_PLAYED_DURATION + " INTEGER,"
|
+ KEY_PLAYED_DURATION + " INTEGER,"
|
||||||
+ KEY_HAS_EMBEDDED_PICTURE + " INTEGER,"
|
+ KEY_HAS_EMBEDDED_PICTURE + " INTEGER,"
|
||||||
+ KEY_LAST_PLAYED_TIME + " INTEGER,"
|
+ KEY_LAST_PLAYED_TIME + " INTEGER,"
|
||||||
+ KEY_LAST_PLAYBACK_SPEED + " TEXT)";
|
+ KEY_MEDIA_LAST_PLAYBACK_SPEED + " REAL)";
|
||||||
|
|
||||||
private static final String CREATE_TABLE_DOWNLOAD_LOG = "CREATE TABLE "
|
private static final String CREATE_TABLE_DOWNLOAD_LOG = "CREATE TABLE "
|
||||||
+ TABLE_NAME_DOWNLOAD_LOG + " (" + TABLE_PRIMARY_KEY + KEY_FEEDFILE
|
+ TABLE_NAME_DOWNLOAD_LOG + " (" + TABLE_PRIMARY_KEY + KEY_FEEDFILE
|
||||||
@ -442,7 +441,7 @@ public class PodDBAdapter {
|
|||||||
values.put(KEY_FILE_URL, media.getFile_url());
|
values.put(KEY_FILE_URL, media.getFile_url());
|
||||||
values.put(KEY_HAS_EMBEDDED_PICTURE, media.hasEmbeddedPicture());
|
values.put(KEY_HAS_EMBEDDED_PICTURE, media.hasEmbeddedPicture());
|
||||||
values.put(KEY_LAST_PLAYED_TIME, media.getLastPlayedTime());
|
values.put(KEY_LAST_PLAYED_TIME, media.getLastPlayedTime());
|
||||||
values.put(KEY_LAST_PLAYBACK_SPEED, media.getLastPlaybackSpeed());
|
values.put(KEY_MEDIA_LAST_PLAYBACK_SPEED, media.getLastPlaybackSpeed());
|
||||||
|
|
||||||
if (media.getPlaybackCompletionDate() != null) {
|
if (media.getPlaybackCompletionDate() != null) {
|
||||||
values.put(KEY_PLAYBACK_COMPLETION_DATE, media.getPlaybackCompletionDate().getTime());
|
values.put(KEY_PLAYBACK_COMPLETION_DATE, media.getPlaybackCompletionDate().getTime());
|
||||||
@ -468,7 +467,7 @@ public class PodDBAdapter {
|
|||||||
values.put(KEY_DURATION, media.getDuration());
|
values.put(KEY_DURATION, media.getDuration());
|
||||||
values.put(KEY_PLAYED_DURATION, media.getPlayedDuration());
|
values.put(KEY_PLAYED_DURATION, media.getPlayedDuration());
|
||||||
values.put(KEY_LAST_PLAYED_TIME, media.getLastPlayedTime());
|
values.put(KEY_LAST_PLAYED_TIME, media.getLastPlayedTime());
|
||||||
values.put(KEY_LAST_PLAYBACK_SPEED, media.getLastPlaybackSpeed());
|
values.put(KEY_MEDIA_LAST_PLAYBACK_SPEED, media.getLastPlaybackSpeed());
|
||||||
db.update(TABLE_NAME_FEED_MEDIA, values, KEY_ID + "=?",
|
db.update(TABLE_NAME_FEED_MEDIA, values, KEY_ID + "=?",
|
||||||
new String[]{String.valueOf(media.getId())});
|
new String[]{String.valueOf(media.getId())});
|
||||||
} else {
|
} else {
|
||||||
@ -479,7 +478,7 @@ public class PodDBAdapter {
|
|||||||
public void setFeedMediaLastPlaybackSpeed(FeedMedia media) {
|
public void setFeedMediaLastPlaybackSpeed(FeedMedia media) {
|
||||||
if (media.getId() != 0) {
|
if (media.getId() != 0) {
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(KEY_LAST_PLAYBACK_SPEED, media.getLastPlaybackSpeed());
|
values.put(KEY_MEDIA_LAST_PLAYBACK_SPEED, media.getLastPlaybackSpeed());
|
||||||
db.update(TABLE_NAME_FEED_MEDIA, values, KEY_ID + "=?",
|
db.update(TABLE_NAME_FEED_MEDIA, values, KEY_ID + "=?",
|
||||||
new String[]{String.valueOf(media.getId())});
|
new String[]{String.valueOf(media.getId())});
|
||||||
} else {
|
} else {
|
||||||
@ -493,7 +492,7 @@ public class PodDBAdapter {
|
|||||||
values.put(KEY_PLAYBACK_COMPLETION_DATE, media.getPlaybackCompletionDate().getTime());
|
values.put(KEY_PLAYBACK_COMPLETION_DATE, media.getPlaybackCompletionDate().getTime());
|
||||||
values.put(KEY_PLAYED_DURATION, media.getPlayedDuration());
|
values.put(KEY_PLAYED_DURATION, media.getPlayedDuration());
|
||||||
// Also reset stored playback speed for media
|
// Also reset stored playback speed for media
|
||||||
values.putNull(KEY_LAST_PLAYBACK_SPEED);
|
values.put(KEY_MEDIA_LAST_PLAYBACK_SPEED, LAST_PLAYBACK_SPEED_UNSET);
|
||||||
db.update(TABLE_NAME_FEED_MEDIA, values, KEY_ID + "=?",
|
db.update(TABLE_NAME_FEED_MEDIA, values, KEY_ID + "=?",
|
||||||
new String[]{String.valueOf(media.getId())});
|
new String[]{String.valueOf(media.getId())});
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user