summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod/activity
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/danoeh/antennapod/activity')
-rw-r--r--src/de/danoeh/antennapod/activity/AudioplayerActivity.java16
-rw-r--r--src/de/danoeh/antennapod/activity/MediaplayerActivity.java9
-rw-r--r--src/de/danoeh/antennapod/activity/VideoplayerActivity.java9
3 files changed, 31 insertions, 3 deletions
diff --git a/src/de/danoeh/antennapod/activity/AudioplayerActivity.java b/src/de/danoeh/antennapod/activity/AudioplayerActivity.java
index 58c2991cb..e85dac186 100644
--- a/src/de/danoeh/antennapod/activity/AudioplayerActivity.java
+++ b/src/de/danoeh/antennapod/activity/AudioplayerActivity.java
@@ -5,6 +5,7 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
+import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
@@ -13,11 +14,13 @@ import android.widget.TextView;
import com.actionbarsherlock.app.SherlockListFragment;
import com.viewpagerindicator.TabPageIndicator;
+import de.danoeh.antennapod.AppConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.adapter.SCListAdapter;
import de.danoeh.antennapod.feed.SimpleChapter;
import de.danoeh.antennapod.fragment.CoverFragment;
import de.danoeh.antennapod.fragment.ItemDescriptionFragment;
+import de.danoeh.antennapod.service.PlaybackService;
public class AudioplayerActivity extends MediaplayerActivity {
@@ -79,8 +82,6 @@ public class AudioplayerActivity extends MediaplayerActivity {
}
}
-
-
public static class MediaPlayerPagerAdapter extends
FragmentStatePagerAdapter {
private int numItems;
@@ -174,6 +175,15 @@ public class AudioplayerActivity extends MediaplayerActivity {
}
+ @Override
+ protected void onReloadNotification(int notificationCode) {
+ if (notificationCode == PlaybackService.EXTRA_CODE_VIDEO) {
+ if (AppConfig.DEBUG)
+ Log.d(TAG,
+ "ReloadNotification received, switching to Videoplayer now");
+ startActivity(new Intent(this, VideoplayerActivity.class));
+
+ }
+ }
-
}
diff --git a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java
index 3fe987bea..0425638bd 100644
--- a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java
+++ b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java
@@ -121,6 +121,13 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity {
handleStatus();
}
};
+
+ /**
+ * Should be used to switch to another player activity if the mime type is
+ * not the correct one for the current activity.
+ */
+ protected abstract void onReloadNotification(int notificationCode);
+
protected BroadcastReceiver notificationReceiver = new BroadcastReceiver() {
@Override
@@ -147,6 +154,8 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity {
positionObserver = null;
}
mediaInfoLoaded = false;
+ onReloadNotification(intent.getIntExtra(
+ PlaybackService.EXTRA_NOTIFICATION_CODE, -1));
queryService();
break;
diff --git a/src/de/danoeh/antennapod/activity/VideoplayerActivity.java b/src/de/danoeh/antennapod/activity/VideoplayerActivity.java
index c2975e8ec..6644cc29b 100644
--- a/src/de/danoeh/antennapod/activity/VideoplayerActivity.java
+++ b/src/de/danoeh/antennapod/activity/VideoplayerActivity.java
@@ -5,6 +5,7 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.service.PlaybackService;
import de.danoeh.antennapod.service.PlayerStatus;
import android.annotation.SuppressLint;
+import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
@@ -194,4 +195,12 @@ public class VideoplayerActivity extends MediaplayerActivity implements
videoSurfaceCreated = false;
}
+ @Override
+ protected void onReloadNotification(int notificationCode) {
+ if (notificationCode == PlaybackService.EXTRA_CODE_AUDIO) {
+ if (AppConfig.DEBUG) Log.d(TAG, "ReloadNotification received, switching to Audioplayer now");
+ startActivity(new Intent(this, AudioplayerActivity.class));
+ }
+ }
+
}