From cc77c9dde3d78f37981073e7b40ae0caa0c21b60 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 5 Jun 2012 21:49:12 +0200 Subject: [PATCH] Changed Length attribute to Duration and type of position to int --- .../activity/MediaplayerActivity.java | 2 +- src/de/podfetcher/feed/FeedMedia.java | 18 +++++++++--------- src/de/podfetcher/storage/PodDBAdapter.java | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/de/podfetcher/activity/MediaplayerActivity.java b/src/de/podfetcher/activity/MediaplayerActivity.java index 37a645cb0..162615d97 100644 --- a/src/de/podfetcher/activity/MediaplayerActivity.java +++ b/src/de/podfetcher/activity/MediaplayerActivity.java @@ -218,7 +218,7 @@ public class MediaplayerActivity extends SherlockActivity { private void getProgress() { FeedMedia media = service.getMedia(); position = media.getPosition(); - length = media.getLength(); + length = media.getDuration(); } } diff --git a/src/de/podfetcher/feed/FeedMedia.java b/src/de/podfetcher/feed/FeedMedia.java index ca2a534f2..51eaf9c7b 100644 --- a/src/de/podfetcher/feed/FeedMedia.java +++ b/src/de/podfetcher/feed/FeedMedia.java @@ -1,8 +1,8 @@ package de.podfetcher.feed; public class FeedMedia extends FeedFile{ - private long length; - private long position; + private int duration; + private int position; // Current position in file private long size; // File size in Byte private String mime_type; private FeedItem item; @@ -15,12 +15,12 @@ public class FeedMedia extends FeedFile{ this.mime_type = mime_type; } - public FeedMedia(long id, FeedItem item, long length, long position, long size, String mime_type, + public FeedMedia(long id, FeedItem item, int duration, int position, long size, String mime_type, String file_url, String download_url) { super(); this.id = id; this.item = item; - this.length = length; + this.duration = duration; this.position = position; this.size = size; this.mime_type = mime_type; @@ -28,19 +28,19 @@ public class FeedMedia extends FeedFile{ this.download_url = download_url; } - public long getLength() { - return length; + public long getDuration() { + return duration; } - public void setLength(long length) { - this.length = length; + public void setDuration(int duration) { + this.duration = duration; } public long getPosition() { return position; } - public void setPosition(long position) { + public void setPosition(int position) { this.position = position; } diff --git a/src/de/podfetcher/storage/PodDBAdapter.java b/src/de/podfetcher/storage/PodDBAdapter.java index d5cb506a1..fce4ff32d 100644 --- a/src/de/podfetcher/storage/PodDBAdapter.java +++ b/src/de/podfetcher/storage/PodDBAdapter.java @@ -32,7 +32,7 @@ public class PodDBAdapter { public static final String KEY_DOWNLOAD_URL = "download_url"; public static final String KEY_PUBDATE = "pubDate"; public static final String KEY_READ = "read"; - public static final String KEY_LENGTH = "length"; + public static final String KEY_DURATION = "duration"; public static final String KEY_POSITION = "position"; public static final String KEY_SIZE = "filesize"; public static final String KEY_MIME_TYPE = "mime_type"; @@ -75,7 +75,7 @@ public class PodDBAdapter { + KEY_DOWNLOAD_URL + " TEXT)"; private static final String CREATE_TABLE_FEED_MEDIA = "CREATE TABLE " - + TABLE_NAME_FEED_MEDIA + " (" + TABLE_PRIMARY_KEY + KEY_LENGTH + + TABLE_NAME_FEED_MEDIA + " (" + TABLE_PRIMARY_KEY + KEY_DURATION + " INTEGER," + KEY_POSITION + " INTEGER," + KEY_SIZE + " INTEGER," + KEY_MIME_TYPE + " TEXT," + KEY_FILE_URL + " TEXT," + KEY_DOWNLOAD_URL + " TEXT)"; @@ -187,7 +187,7 @@ public class PodDBAdapter { public long setMedia(FeedMedia media) { open(); ContentValues values = new ContentValues(); - values.put(KEY_LENGTH, media.getLength()); + values.put(KEY_DURATION, media.getDuration()); values.put(KEY_POSITION, media.getPosition()); values.put(KEY_SIZE, media.getSize()); values.put(KEY_MIME_TYPE, media.getMime_type()); @@ -304,8 +304,8 @@ public class PodDBAdapter { } FeedMedia media = new FeedMedia(rowIndex, owner, - cursor.getLong(cursor.getColumnIndex(KEY_LENGTH)), - cursor.getLong(cursor.getColumnIndex(KEY_POSITION)), + cursor.getInt(cursor.getColumnIndex(KEY_DURATION)), + cursor.getInt(cursor.getColumnIndex(KEY_POSITION)), cursor.getLong(cursor.getColumnIndex(KEY_SIZE)), cursor.getString(cursor.getColumnIndex(KEY_MIME_TYPE)), cursor.getString(cursor.getColumnIndex(KEY_FILE_URL)),