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.ItemviewActivity"/>
<activity android:name="de.podfetcher.activity.DownloadActivity" <activity android:name="de.podfetcher.activity.DownloadActivity"
android:label="@string/downloads_label"/> 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.DownloadService" />
<service android:enabled="true" android:name="de.podfetcher.service.PlaybackService" > <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

@ -10,5 +10,4 @@
<item name="android:textColor">@color/black</item> <item name="android:textColor">@color/black</item>
</style> </style>
</resources> </resources>

View File

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

View File

@ -305,24 +305,28 @@ public class PodDBAdapter {
* Inserts or updates a download status. * Inserts or updates a download status.
* */ * */
public long setDownloadStatus(DownloadStatus status) { public long setDownloadStatus(DownloadStatus status) {
ContentValues values = new ContentValues(); // Don't save failed downloads
values.put(KEY_FEEDFILE, status.getFeedFile().getId()); if (status.getFeedFile() != null) {
if (status.getFeedFile().getClass() == Feed.class) { ContentValues values = new ContentValues();
values.put(KEY_FEEDFILETYPE, FEEDFILETYPE_FEED); values.put(KEY_FEEDFILE, status.getFeedFile().getId());
} else if (status.getFeedFile().getClass() == FeedImage.class) { if (status.getFeedFile().getClass() == Feed.class) {
values.put(KEY_FEEDFILETYPE, FEEDFILETYPE_FEEDIMAGE); values.put(KEY_FEEDFILETYPE, FEEDFILETYPE_FEED);
} else if (status.getFeedFile().getClass() == FeedMedia.class) { } else if (status.getFeedFile().getClass() == FeedImage.class) {
values.put(KEY_FEEDFILETYPE, FEEDFILETYPE_FEEDMEDIA); 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_REASON, status.getReason());
values.put(KEY_SUCCESSFUL, status.isSuccessful()); values.put(KEY_SUCCESSFUL, status.isSuccessful());
values.put(KEY_COMPLETION_DATE, status.getCompletionDate().getTime()); values.put(KEY_COMPLETION_DATE, status.getCompletionDate()
if (status.getId() == 0) { .getTime());
status.setId(db.insert(TABLE_NAME_DOWNLOAD_LOG, null, values)); if (status.getId() == 0) {
} else { status.setId(db.insert(TABLE_NAME_DOWNLOAD_LOG, null, values));
db.update(TABLE_NAME_DOWNLOAD_LOG, values, KEY_ID + "=?", } else {
new String[] { String.valueOf(status.getId()) }); db.update(TABLE_NAME_DOWNLOAD_LOG, values, KEY_ID + "=?",
new String[] { String.valueOf(status.getId()) });
}
} }
return status.getId(); return status.getId();
} }