summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2012-06-27 21:39:42 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2012-06-27 21:39:42 +0200
commitb291d56fbb10504fb245fc024c7bd74beb15d87a (patch)
treebb6b552bdfbadf41c1305bc80d2a799d2153862b
parent3931244c354632cb723353538b75eff952299098 (diff)
downloadAntennaPod-b291d56fbb10504fb245fc024c7bd74beb15d87a.zip
Ported media control buttons to landscape video player
-rw-r--r--res/layout-land/mediaplayer_activity.xml130
-rw-r--r--src/de/podfetcher/activity/MediaplayerActivity.java59
2 files changed, 114 insertions, 75 deletions
diff --git a/res/layout-land/mediaplayer_activity.xml b/res/layout-land/mediaplayer_activity.xml
index 52c64d4ca..bfb9f2d94 100644
--- a/res/layout-land/mediaplayer_activity.xml
+++ b/res/layout-land/mediaplayer_activity.xml
@@ -3,49 +3,93 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
-
+
<VideoView
- android:id="@+id/videoview"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- />
- <!-- Mediaplayer controls -->
-
- <RelativeLayout
- android:id="@+id/playercontrols"
- android:layout_width="match_parent"
- android:layout_height="30dp"
- android:layout_gravity="bottom|center"
- android:background="@color/gray" >
-
- <TextView
- android:id="@+id/txtvPosition"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentLeft="true"
- android:layout_alignParentBottom="true"
- android:textColor="@color/white"
- android:text="@string/position_default_label" />
-
- <TextView
- android:id="@+id/txtvLength"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:layout_alignParentRight="true"
- android:layout_centerVertical="true"
- android:text="@string/position_default_label"
- android:textColor="@color/white" />
-
- <SeekBar
- android:id="@+id/sbPosition"
+ android:id="@+id/videoview"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+ <!-- Mediaplayer controls -->
+
+ <LinearLayout
+ android:id="@+id/overlay"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_width="0px"
- android:layout_toLeftOf="@id/txtvLength"
- android:layout_toRightOf="@id/txtvPosition"
- android:layout_alignParentBottom="true"
- android:max="500" />
-
- </RelativeLayout>
-
+ android:layout_gravity="bottom|center"
+ android:alpha="0"
+ android:background="@color/white"
+ android:orientation="vertical" >
+
+ <RelativeLayout
+ android:id="@+id/playercontrol"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="clip_horizontal"
+ android:layout_margin="4dp" >
+
+ <ImageButton
+ android:id="@+id/butPlay"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerHorizontal="true"
+ android:background="@drawable/borderless_button"
+ android:src="@android:drawable/ic_media_pause" />
+
+ <ImageButton
+ android:id="@+id/butFF"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:layout_marginLeft="8dp"
+ android:layout_toRightOf="@+id/butPlay"
+ android:background="@drawable/borderless_button"
+ android:src="@android:drawable/ic_media_ff" />
+
+ <ImageButton
+ android:id="@+id/butRev"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:layout_marginRight="8dp"
+ android:layout_toLeftOf="@+id/butPlay"
+ android:background="@drawable/borderless_button"
+ android:src="@android:drawable/ic_media_rew" />
+
+ </RelativeLayout>
+
+ <RelativeLayout
+ android:id="@+id/timecontrol"
+ android:layout_width="match_parent"
+ android:layout_height="30dp"
+ android:layout_marginBottom="4dp" >
+
+ <TextView
+ android:id="@+id/txtvPosition"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:text="@string/position_default_label" />
+
+ <TextView
+ android:id="@+id/txtvLength"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
+ android:layout_alignParentRight="true"
+ android:text="@string/position_default_label" />
+
+ <SeekBar
+ android:id="@+id/sbPosition"
+ android:layout_width="0px"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="8dp"
+ android:layout_marginRight="8dp"
+ android:layout_toLeftOf="@+id/txtvLength"
+ android:layout_toRightOf="@+id/txtvPosition"
+ android:max="500" />
+
+ </RelativeLayout>
+
+ </LinearLayout>
+
</FrameLayout> \ No newline at end of file
diff --git a/src/de/podfetcher/activity/MediaplayerActivity.java b/src/de/podfetcher/activity/MediaplayerActivity.java
index 91d6107c1..38f168632 100644
--- a/src/de/podfetcher/activity/MediaplayerActivity.java
+++ b/src/de/podfetcher/activity/MediaplayerActivity.java
@@ -116,7 +116,7 @@ public class MediaplayerActivity extends SherlockActivity implements
setContentView(R.layout.mediaplayer_activity);
}
setupGUI();
-
+
}
@Override
@@ -187,17 +187,13 @@ public class MediaplayerActivity extends SherlockActivity implements
positionObserver.cancel(true);
positionObserver = null;
}
- if (orientation == Configuration.ORIENTATION_PORTRAIT) {
- butPlay.setImageResource(android.R.drawable.ic_media_play);
- }
+ butPlay.setImageResource(android.R.drawable.ic_media_play);
break;
case PLAYING:
setStatusMsg(R.string.player_playing_msg, View.INVISIBLE);
loadMediaInfo();
setupPositionObserver();
- if (orientation == Configuration.ORIENTATION_PORTRAIT) {
- butPlay.setImageResource(android.R.drawable.ic_media_pause);
- }
+ butPlay.setImageResource(android.R.drawable.ic_media_pause);
break;
case PREPARING:
setStatusMsg(R.string.player_preparing_msg, View.VISIBLE);
@@ -209,9 +205,7 @@ public class MediaplayerActivity extends SherlockActivity implements
case PREPARED:
loadMediaInfo();
setStatusMsg(R.string.player_ready_msg, View.VISIBLE);
- if (orientation == Configuration.ORIENTATION_PORTRAIT) {
- butPlay.setImageResource(android.R.drawable.ic_media_play);
- }
+ butPlay.setImageResource(android.R.drawable.ic_media_play);
break;
case SEEKING:
setStatusMsg(R.string.player_seeking_msg, View.VISIBLE);
@@ -289,6 +283,9 @@ public class MediaplayerActivity extends SherlockActivity implements
sbPosition = (SeekBar) findViewById(R.id.sbPosition);
txtvPosition = (TextView) findViewById(R.id.txtvPosition);
txtvLength = (TextView) findViewById(R.id.txtvLength);
+ butPlay = (ImageButton) findViewById(R.id.butPlay);
+ butRev = (ImageButton) findViewById(R.id.butRev);
+ butFF = (ImageButton) findViewById(R.id.butFF);
sbPosition.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
int duration;
@@ -322,34 +319,32 @@ public class MediaplayerActivity extends SherlockActivity implements
}
});
+ butPlay.setOnClickListener(playbuttonListener);
+
+ butFF.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (status == PlayerStatus.PLAYING) {
+ playbackService.seekDelta(DEFAULT_SEEK_DELTA);
+ }
+ }
+ });
+
+ butRev.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (status == PlayerStatus.PLAYING) {
+ playbackService.seekDelta(-DEFAULT_SEEK_DELTA);
+ }
+ }
+ });
+
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
imgvCover = (ImageView) findViewById(R.id.imgvCover);
txtvStatus = (TextView) findViewById(R.id.txtvStatus);
- butPlay = (ImageButton) findViewById(R.id.butPlay);
- butRev = (ImageButton) findViewById(R.id.butRev);
- butFF = (ImageButton) findViewById(R.id.butFF);
txtvTitle = (TextView) findViewById(R.id.txtvTitle);
txtvFeed = (TextView) findViewById(R.id.txtvFeed);
- butPlay.setOnClickListener(playbuttonListener);
-
- butFF.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- if (status == PlayerStatus.PLAYING) {
- playbackService.seekDelta(DEFAULT_SEEK_DELTA);
- }
- }
- });
-
- butRev.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- if (status == PlayerStatus.PLAYING) {
- playbackService.seekDelta(-DEFAULT_SEEK_DELTA);
- }
- }
- });
} else {
setTheme(R.style.Theme_Sherlock_Light_NoActionBar);
videoview = (VideoView) findViewById(R.id.videoview);