summaryrefslogtreecommitdiff
path: root/src/de/podfetcher/activity
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2012-07-02 16:41:19 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2012-07-02 16:41:19 +0200
commit3c2f083378ffdcfea4e5a9a9ba3d24e4465dafae (patch)
tree9290090d50c5488e19319e78e559997d4f3f9aa2 /src/de/podfetcher/activity
parent704e9749402e72a01896241e5b675b1bae65d91f (diff)
downloadAntennaPod-3c2f083378ffdcfea4e5a9a9ba3d24e4465dafae.zip
Improved media info loading behaviour of mediaplayeractivity
Diffstat (limited to 'src/de/podfetcher/activity')
-rw-r--r--src/de/podfetcher/activity/MediaplayerActivity.java44
1 files changed, 26 insertions, 18 deletions
diff --git a/src/de/podfetcher/activity/MediaplayerActivity.java b/src/de/podfetcher/activity/MediaplayerActivity.java
index bfeda933b..62f6dde80 100644
--- a/src/de/podfetcher/activity/MediaplayerActivity.java
+++ b/src/de/podfetcher/activity/MediaplayerActivity.java
@@ -64,6 +64,8 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
/** True if video controls are currently visible. */
private boolean videoControlsShowing = true;
+ /** True if media information was loaded. */
+ private boolean mediaInfoLoaded = false;
private PlaybackService playbackService;
private MediaPositionObserver positionObserver;
@@ -157,7 +159,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d(TAG, "Creating Activity");
-
+
orientation = getResources().getConfiguration().orientation;
manager = FeedManager.getInstance();
getWindow().setFormat(PixelFormat.TRANSPARENT);
@@ -224,6 +226,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
break;
case PREPARING:
setStatusMsg(R.string.player_preparing_msg, View.VISIBLE);
+ loadMediaInfo();
break;
case STOPPED:
setStatusMsg(R.string.player_stopped_msg, View.VISIBLE);
@@ -279,27 +282,32 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
}
private void loadMediaInfo() {
- Log.d(TAG, "Loading media info");
- if (media != null) {
- MediaPlayer player = playbackService.getPlayer();
+ if (!mediaInfoLoaded) {
+ Log.d(TAG, "Loading media info");
+ if (media != null) {
- if (orientation == Configuration.ORIENTATION_PORTRAIT) {
- getSupportActionBar().setSubtitle(media.getItem().getTitle());
- getSupportActionBar().setTitle(
- media.getItem().getFeed().getTitle());
- pagerAdapter.notifyDataSetChanged();
+ if (orientation == Configuration.ORIENTATION_PORTRAIT) {
+ getSupportActionBar().setSubtitle(
+ media.getItem().getTitle());
+ getSupportActionBar().setTitle(
+ media.getItem().getFeed().getTitle());
+ pagerAdapter.notifyDataSetChanged();
- }
+ }
- txtvPosition.setText(Converter.getDurationStringLong((player
- .getCurrentPosition())));
- txtvLength.setText(Converter.getDurationStringLong(player
- .getDuration()));
- if (playbackService != null) {
- updateProgressbarPosition();
- } else {
- sbPosition.setProgress(0);
+ txtvPosition.setText(Converter.getDurationStringLong((media
+ .getPosition())));
+
+ if (!playbackService.isShouldStream()) {
+ txtvLength.setText(Converter.getDurationStringLong(media
+ .getDuration()));
+ float progress = ((float) media.getPosition())
+ / media.getDuration();
+ sbPosition.setProgress((int) (progress * sbPosition
+ .getMax()));
+ }
}
+ mediaInfoLoaded = true;
}
}