Improved layout of player controls

This commit is contained in:
daniel oeh 2013-02-01 23:59:02 +01:00
parent 2566dd012d
commit 4b9831603b
8 changed files with 99 additions and 74 deletions

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<solid android:color="#20EAEAEA" />
</shape>
</item>
<item android:top="1dp">
<shape android:shape="rectangle" >
<solid android:color="#20E5E5E5" />
</shape>
</item>
<item android:top="2dp">
<shape android:shape="rectangle" >
<solid android:color="#20DDDDDD" />
</shape>
</item>
<item android:top="3dp">
<shape android:shape="rectangle" >
<solid android:color="#10BABABA" />
</shape>
</item>
<item android:top="4dp">
<shape android:shape="rectangle" >
<solid android:color="#D2D2D2" />
</shape>
</item>
<item android:top="5dp">
<shape android:shape="rectangle" >
<solid android:color="@color/overlay_light" />
</shape>
</item>
</layer-list>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<solid android:color="#45B3E1" />
</shape>
</item>
<item android:top="1dp">
<shape android:shape="rectangle" >
<solid android:color="@color/overlay_dark" />
</shape>
</item>
</layer-list>

View File

@ -23,7 +23,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|center" android:layout_gravity="bottom|center"
android:background="?attr/video_overlay_background" android:background="?attr/overlay_background"
android:orientation="vertical" > android:orientation="vertical" >
<RelativeLayout <RelativeLayout

View File

@ -11,87 +11,59 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" /> android:layout_alignParentTop="true" />
<LinearLayout <RelativeLayout
android:id="@+id/player_control" android:id="@+id/player_control"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_marginTop="8dp" > android:background="?attr/overlay_background" >
<ImageButton
android:id="@+id/butRev"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.02"
android:background="?attr/borderless_button"
android:src="?attr/av_rewind" />
<View
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="@color/gray" />
<ImageButton <ImageButton
android:id="@+id/butPlay" android:id="@+id/butPlay"
android:layout_width="wrap_content" android:layout_width="60dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.14" android:layout_centerHorizontal="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:background="?attr/borderless_button" android:background="?attr/borderless_button"
android:src="?attr/av_pause" /> android:src="?attr/av_pause" />
<View <ImageButton
android:layout_width="0.5dp" android:id="@+id/butRev"
android:layout_width="60dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="8dp" android:layout_toLeftOf="@id/butPlay"
android:layout_marginTop="8dp" android:background="?attr/borderless_button"
android:background="@color/gray" /> android:src="?attr/av_rewind" />
<ImageButton <ImageButton
android:id="@+id/butFF" android:id="@+id/butFF"
android:layout_width="wrap_content" android:layout_width="60dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.02" android:layout_toRightOf="@id/butPlay"
android:background="?attr/borderless_button" android:background="?attr/borderless_button"
android:src="?attr/av_fast_forward" /> android:src="?attr/av_fast_forward" />
</LinearLayout> </RelativeLayout>
<SeekBar
android:id="@+id/sbPosition"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/player_control"
android:layout_alignParentLeft="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:max="500" />
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_alignParentLeft="true"
android:layout_below="@+id/sbPosition"
android:layout_margin="8dp"
android:background="@color/gray" />
<RelativeLayout <RelativeLayout
android:id="@+id/playtime_layout" android:id="@+id/playtime_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_above="@+id/sbPosition" android:layout_above="@id/player_control"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_marginLeft="8dp" android:background="?attr/overlay_drawable" >
android:layout_marginRight="8dp"
android:layout_marginTop="8dp" >
<TextView <TextView
android:id="@+id/txtvPosition" android:id="@+id/txtvPosition"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:text="@string/position_default_label" /> android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginTop="16dp"
android:text="@string/position_default_label"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro" />
<TextView <TextView
android:id="@+id/txtvLength" android:id="@+id/txtvLength"
@ -99,15 +71,24 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:text="@string/position_default_label" /> android:layout_centerVertical="true"
android:layout_marginRight="8dp"
android:layout_marginTop="16dp"
android:text="@string/position_default_label"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro" />
<TextView <SeekBar
android:id="@+id/txtvStatus" android:id="@+id/sbPosition"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_centerVertical="true"
android:layout_centerHorizontal="true" android:layout_marginLeft="8dp"
android:textColor="?android:attr/textColorTertiary" /> android:layout_marginRight="8dp"
android:layout_marginTop="16dp"
android:layout_toLeftOf="@id/txtvLength"
android:layout_toRightOf="@id/txtvPosition"
android:max="500" />
</RelativeLayout> </RelativeLayout>
<android.support.v4.view.ViewPager <android.support.v4.view.ViewPager
@ -118,10 +99,4 @@
android:layout_below="@id/tabs" > android:layout_below="@id/tabs" >
</android.support.v4.view.ViewPager> </android.support.v4.view.ViewPager>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_below="@id/viewpager"
android:background="@color/ics_gray" />
</RelativeLayout> </RelativeLayout>

View File

@ -27,8 +27,9 @@
<attr name="type_video" format="reference" /> <attr name="type_video" format="reference" />
<attr name="borderless_button" format="reference" /> <attr name="borderless_button" format="reference" />
<attr name="spinner_button" format="reference" /> <attr name="spinner_button" format="reference" />
<attr name="overlay_drawable" format="reference" />
<!-- Used in itemdescription --> <!-- Used in itemdescription -->
<attr name="non_transparent_background" format="reference" /> <attr name="non_transparent_background" format="reference" />
<attr name="video_overlay_background" format="color" /> <attr name="overlay_background" format="color" />
</resources> </resources>

View File

@ -26,8 +26,9 @@
<color name="status_unread">#99CC00</color> <color name="status_unread">#99CC00</color>
<color name="status_progress">#FFBB33</color> <color name="status_progress">#FFBB33</color>
<color name="status_playing">#EE5F52</color> <color name="status_playing">#EE5F52</color>
<color name="video_overlay_dark">#262C31</color> <color name="overlay_dark">#262C31</color>
<color name="video_overlay_light">#DDDDDD</color> <color name="overlay_light">#DDDDDD</color>
<!-- Use Gingerbread-orange --> <!-- Use Gingerbread-orange -->
<color name="selection_background_color_dark">#FEBB20</color> <color name="selection_background_color_dark">#FEBB20</color>
<color name="selection_background_color_light">#FEBB20</color> <color name="selection_background_color_light">#FEBB20</color>

View File

@ -29,8 +29,9 @@
<item name="attr/type_video">@drawable/type_video</item> <item name="attr/type_video">@drawable/type_video</item>
<item name="attr/non_transparent_background">@color/white</item> <item name="attr/non_transparent_background">@color/white</item>
<item name="attr/borderless_button">@drawable/borderless_button</item> <item name="attr/borderless_button">@drawable/borderless_button</item>
<item name="attr/video_overlay_background">@color/video_overlay_light</item> <item name="attr/overlay_background">@color/overlay_light</item>
<item name="attr/spinner_button">@drawable/spinner_button</item> <item name="attr/spinner_button">@drawable/spinner_button</item>
<item name="attr/overlay_drawable">@drawable/overlay_drawable</item>
</style> </style>
<style name="AntennaPod.TabPageIndicator" parent="Widget.TabPageIndicator"> <style name="AntennaPod.TabPageIndicator" parent="Widget.TabPageIndicator">
@ -76,8 +77,9 @@
<item name="attr/type_video">@drawable/type_video_dark</item> <item name="attr/type_video">@drawable/type_video_dark</item>
<item name="attr/non_transparent_background">@color/black</item> <item name="attr/non_transparent_background">@color/black</item>
<item name="attr/borderless_button">@drawable/borderless_button_dark</item> <item name="attr/borderless_button">@drawable/borderless_button_dark</item>
<item name="attr/video_overlay_background">@color/video_overlay_dark</item> <item name="attr/overlay_background">@color/overlay_dark</item>
<item name="attr/spinner_button">@drawable/spinner_button_dark</item> <item name="attr/spinner_button">@drawable/spinner_button_dark</item>
<item name="attr/overlay_drawable">@drawable/overlay_drawable_dark</item>
</style> </style>
<style name="AntennaPod.DarkTabPageIndicator" parent="AntennaPod.TabPageIndicator"> <style name="AntennaPod.DarkTabPageIndicator" parent="AntennaPod.TabPageIndicator">

View File

@ -34,7 +34,6 @@ public class AudioplayerActivity extends MediaplayerActivity {
ViewPager viewpager; ViewPager viewpager;
TabPageIndicator tabs; TabPageIndicator tabs;
MediaPlayerPagerAdapter pagerAdapter; MediaPlayerPagerAdapter pagerAdapter;
TextView txtvStatus;
@Override @Override
protected void onAwaitingVideoSurface() { protected void onAwaitingVideoSurface() {
@ -43,20 +42,17 @@ public class AudioplayerActivity extends MediaplayerActivity {
@Override @Override
protected void postStatusMsg(int resId) { protected void postStatusMsg(int resId) {
txtvStatus.setText(resId);
} }
@Override @Override
protected void clearStatusMsg() { protected void clearStatusMsg() {
txtvStatus.setText("");
} }
@Override @Override
protected void setupGUI() { protected void setupGUI() {
super.setupGUI(); super.setupGUI();
txtvStatus = (TextView) findViewById(R.id.txtvStatus);
viewpager = (ViewPager) findViewById(R.id.viewpager); viewpager = (ViewPager) findViewById(R.id.viewpager);
tabs = (TabPageIndicator) findViewById(R.id.tabs); tabs = (TabPageIndicator) findViewById(R.id.tabs);
pagerAdapter = new MediaPlayerPagerAdapter(getSupportFragmentManager()); pagerAdapter = new MediaPlayerPagerAdapter(getSupportFragmentManager());