Videoplayer bugfixes + Feedhandler bugfixes

This commit is contained in:
daniel oeh 2012-07-03 11:41:41 +02:00
parent 1eefeec79f
commit c8977b719f
6 changed files with 47 additions and 33 deletions

View File

@ -30,7 +30,7 @@
<activity android:name="de.podfetcher.activity.ItemviewActivity"/>
<activity android:name="de.podfetcher.activity.DownloadActivity"
android:label="@string/downloads_label"/>
<activity android:name="de.podfetcher.activity.MediaplayerActivity" android:launchMode="singleTask" android:configChanges="orientation" android:theme="@style/StyledIndicators"/>
<activity android:name="de.podfetcher.activity.MediaplayerActivity" android:launchMode="singleTask" android:configChanges="orientation" android:theme="@style/Theme.MediaPlayer"/>
<service android:enabled="true" android:name="de.podfetcher.service.DownloadService" />
<service android:enabled="true" android:name="de.podfetcher.service.PlaybackService" >

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.MediaPlayer" parent="@style/Theme.Sherlock.Light.ForceOverflow">
<item name="android:windowActionBarOverlay">true</item>
</style>
</resources>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.MediaPlayer" parent="@style/StyledIndicators"></style>
</resources>

View File

@ -9,6 +9,5 @@
<item name="vpiTabPageIndicatorStyle">@style/Widget.TabPageIndicator</item>
<item name="android:textColor">@color/black</item>
</style>
</resources>

View File

@ -404,7 +404,6 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
videoview.setOnClickListener(playbuttonListener);
videoview.setOnTouchListener(onVideoviewTouched);
setupVideoControlsToggler();
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
@ -431,7 +430,9 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
videoControlsToggler.cancel(true);
}
toggleVideoControlsVisibility();
setupVideoControlsToggler();
if (videoControlsShowing) {
setupVideoControlsToggler();
}
return true;
} else {
@ -602,7 +603,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
videoControlsToggler = null;
}
private static final int WAITING_INTERVALL = 3000;
private static final int WAITING_INTERVALL = 5000;
private static final String TAG = "VideoControlsToggler";
@Override
@ -617,14 +618,12 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
@Override
protected Void doInBackground(Void... params) {
while (!isCancelled()) {
try {
Thread.sleep(WAITING_INTERVALL);
} catch (InterruptedException e) {
return null;
}
publishProgress();
try {
Thread.sleep(WAITING_INTERVALL);
} catch (InterruptedException e) {
return null;
}
publishProgress();
return null;
}

View File

@ -244,7 +244,7 @@ public class PodDBAdapter {
} else {
db.update(TABLE_NAME_FEED_MEDIA, values, KEY_ID + "=?",
new String[] { String.valueOf(media.getId()) });
}
}
return media.getId();
}
@ -272,7 +272,7 @@ public class PodDBAdapter {
}
values.put(KEY_FEED, item.getFeed().getId());
values.put(KEY_READ, item.isRead());
if (item.getId() == 0) {
item.setId(db.insert(TABLE_NAME_FEED_ITEMS, null, values));
} else {
@ -281,7 +281,7 @@ public class PodDBAdapter {
}
if (item.getSimpleChapters() != null) {
setSimpleChapters(item);
}
}
return item.getId();
}
@ -305,24 +305,28 @@ public class PodDBAdapter {
* Inserts or updates a download status.
* */
public long setDownloadStatus(DownloadStatus status) {
ContentValues values = new ContentValues();
values.put(KEY_FEEDFILE, status.getFeedFile().getId());
if (status.getFeedFile().getClass() == Feed.class) {
values.put(KEY_FEEDFILETYPE, FEEDFILETYPE_FEED);
} else if (status.getFeedFile().getClass() == FeedImage.class) {
values.put(KEY_FEEDFILETYPE, FEEDFILETYPE_FEEDIMAGE);
} else if (status.getFeedFile().getClass() == FeedMedia.class) {
values.put(KEY_FEEDFILETYPE, FEEDFILETYPE_FEEDMEDIA);
}
// Don't save failed downloads
if (status.getFeedFile() != null) {
ContentValues values = new ContentValues();
values.put(KEY_FEEDFILE, status.getFeedFile().getId());
if (status.getFeedFile().getClass() == Feed.class) {
values.put(KEY_FEEDFILETYPE, FEEDFILETYPE_FEED);
} else if (status.getFeedFile().getClass() == FeedImage.class) {
values.put(KEY_FEEDFILETYPE, FEEDFILETYPE_FEEDIMAGE);
} else if (status.getFeedFile().getClass() == FeedMedia.class) {
values.put(KEY_FEEDFILETYPE, FEEDFILETYPE_FEEDMEDIA);
}
values.put(KEY_REASON, status.getReason());
values.put(KEY_SUCCESSFUL, status.isSuccessful());
values.put(KEY_COMPLETION_DATE, status.getCompletionDate().getTime());
if (status.getId() == 0) {
status.setId(db.insert(TABLE_NAME_DOWNLOAD_LOG, null, values));
} else {
db.update(TABLE_NAME_DOWNLOAD_LOG, values, KEY_ID + "=?",
new String[] { String.valueOf(status.getId()) });
values.put(KEY_REASON, status.getReason());
values.put(KEY_SUCCESSFUL, status.isSuccessful());
values.put(KEY_COMPLETION_DATE, status.getCompletionDate()
.getTime());
if (status.getId() == 0) {
status.setId(db.insert(TABLE_NAME_DOWNLOAD_LOG, null, values));
} else {
db.update(TABLE_NAME_DOWNLOAD_LOG, values, KEY_ID + "=?",
new String[] { String.valueOf(status.getId()) });
}
}
return status.getId();
}