Permalink
Browse files

Backport the AudioPreview activity from Music2 to Music

Change-Id: I1e1ec54a4613ef60e9a4539d5c50ed0874764b93
  • Loading branch information...
Marco Nelissen
Marco Nelissen committed May 10, 2010
1 parent a51d6fe commit 8d08ec235831d71fdd7f7b6f7757c2bc19528fae
Showing with 638 additions and 240 deletions.
  1. +2 −0 Android.mk
  2. +25 −6 AndroidManifest.xml
  3. +3 −0 proguard.flags
  4. +52 −0 res/drawable-finger/progress_horizontal.xml
  5. BIN res/drawable-hdpi-finger/panel_now_playing_progress_bg.9.png
  6. BIN res/drawable-hdpi/btn_playback_ic_pause_small.png
  7. BIN res/drawable-hdpi/btn_playback_ic_play_small.png
  8. BIN res/drawable-hdpi/btn_playback_small_normal.png
  9. BIN res/drawable-hdpi/btn_playback_small_pressed.png
  10. BIN res/drawable-hdpi/btn_playback_small_selected.png
  11. BIN res/drawable-hdpi/now_playing_progress_handle_normal.png
  12. BIN res/drawable-hdpi/now_playing_progress_handle_pressed.png
  13. BIN res/drawable-hdpi/now_playing_progress_handle_selected.png
  14. BIN res/drawable-mdpi-finger/panel_now_playing_progress_bg.9.png
  15. BIN res/drawable-mdpi/btn_playback_ic_pause_small.png
  16. BIN res/drawable-mdpi/btn_playback_ic_play_small.png
  17. BIN res/drawable-mdpi/btn_playback_small_normal.png
  18. BIN res/drawable-mdpi/btn_playback_small_pressed.png
  19. BIN res/drawable-mdpi/btn_playback_small_selected.png
  20. BIN res/drawable-mdpi/now_playing_progress_handle_normal.png
  21. BIN res/drawable-mdpi/now_playing_progress_handle_pressed.png
  22. BIN res/drawable-mdpi/now_playing_progress_handle_selected.png
  23. +21 −0 res/drawable/btn_nowplaying_background_small.xml
  24. +34 −0 res/drawable/seek_thumb.xml
  25. +98 −0 res/layout-finger/audiopreview.xml
  26. +381 −0 src/com/android/music/AudioPreview.java
  27. +1 −2 src/com/android/music/IMediaPlaybackService.aidl
  28. +10 −45 src/com/android/music/MediaPlaybackActivity.java
  29. +11 −66 src/com/android/music/MediaPlaybackService.java
  30. +0 −121 src/com/android/music/StreamStarter.java
View
@@ -10,6 +10,8 @@ LOCAL_PACKAGE_NAME := Music
LOCAL_SDK_VERSION := 8
+LOCAL_PROGUARD_FLAGS := -include $(LOCAL_PATH)/proguard.flags
+
include $(BUILD_PACKAGE)
# Use the folloing include to make our test apk.
View
@@ -72,7 +72,7 @@
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="content"/>
- <data android:scheme="file"/>
+ <data android:host="media"/>
<data android:mimeType="audio/*"/>
<data android:mimeType="application/ogg"/>
<data android:mimeType="application/x-ogg"/>
@@ -84,8 +84,17 @@
</intent-filter>
</activity>
- <activity android:name="com.android.music.StreamStarter"
- android:theme="@android:style/Theme.Dialog" >
+ <activity android:name="AudioPreview" android:theme="@android:style/Theme.Dialog"
+ android:excludeFromRecents="true" >
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <data android:scheme="file"/>
+ <data android:mimeType="audio/*"/>
+ <data android:mimeType="application/ogg"/>
+ <data android:mimeType="application/x-ogg"/>
+ <data android:mimeType="application/itunes"/>
+ </intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
@@ -96,11 +105,21 @@
<data android:mimeType="audio/mpeg"/>
<data android:mimeType="audio/mp4"/>
<data android:mimeType="audio/mp4a-latm"/>
- <data android:mimeType="application/ogg"/>
- <data android:mimeType="application/x-ogg"/>
- <data android:mimeType="audio/ogg"/>
+ </intent-filter>
+ <intent-filter
+ android:priority="-1">
+ <action android:name="android.intent.action.VIEW" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+ <data android:scheme="content" />
+ <data android:mimeType="audio/mp3"/>
+ <data android:mimeType="audio/x-mp3"/>
+ <data android:mimeType="audio/mpeg"/>
+ <data android:mimeType="audio/mp4"/>
+ <data android:mimeType="audio/mp4a-latm"/>
</intent-filter>
</activity>
+
<activity android:name="com.android.music.ArtistAlbumBrowserActivity">
<intent-filter>
<action android:name="android.intent.action.PICK" />
View
@@ -0,0 +1,3 @@
+-keep class com.android.music.AudioPreview {
+ public void playPauseClicked(android.view.View);
+}
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item android:id="@android:id/background">
+ <shape>
+ <gradient
+ android:startColor="#3f808080"
+ android:endColor="#7f000000"
+ android:angle="270"
+ />
+ </shape>
+ </item>
+
+ <item android:id="@android:id/secondaryProgress">
+ <clip android:drawable="@drawable/panel_now_playing_progress_bg"/>
+ </item>
+
+ <!-- Can't actually use
+ android:drawable="@drawable/panel_now_playing_progress_bar"
+ here, so fake it with a similar looking gradient.
+ -->
+ <item android:id="@android:id/progress">
+ <clip>
+ <shape>
+ <gradient
+ android:startColor="#ff85d20f"
+ android:endColor="#ff466607"
+ android:angle="270"
+ />
+ </shape>
+ </clip>
+ </item>
+
+
+
+</layer-list>
+
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_pressed="true" android:drawable="@drawable/btn_playback_small_pressed" />
+ <item android:state_focused="true" android:state_enabled="true" android:drawable="@drawable/btn_playback_small_selected" />
+ <item android:drawable="@drawable/btn_playback_small_normal" />
+</selector>
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- This is the thumb on the seek bar. -->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item android:state_pressed="true"
+ android:state_window_focused="true"
+ android:drawable="@drawable/now_playing_progress_handle_pressed" />
+
+ <item android:state_focused="true"
+ android:state_window_focused="true"
+ android:drawable="@drawable/now_playing_progress_handle_selected" />
+
+ <item android:state_selected="true"
+ android:state_window_focused="true"
+ android:drawable="@drawable/now_playing_progress_handle_selected" />
+
+ <item android:drawable="@drawable/now_playing_progress_handle_normal" />
+
+</selector>
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="10dip">
+
+ <ProgressBar android:id="@+id/spinner"
+ style="?android:attr/progressBarStyleLarge"
+ android:layout_gravity="center"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
+ <TextView android:id="@+id/loading"
+ android:paddingTop="5dip"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:textSize="14sp"
+ android:textColor="#ffffffff" />
+
+ <SeekBar android:id="@+id/progress"
+ android:background="#000000f0"
+ android:progressDrawable="@drawable/progress_horizontal"
+ android:thumb="@drawable/seek_thumb"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingLeft="8dip"
+ android:paddingRight="8dip"
+ android:visibility="gone" />
+
+ <LinearLayout
+ android:id="@+id/titleandbuttons"
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:visibility="gone" >
+
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_width="0dip"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="8dip">
+
+ <TextView android:id="@+id/line1"
+ android:paddingTop="5dip"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:textSize="14sp"
+ android:textColor="#ffffffff" />
+
+ <TextView android:id="@+id/line2"
+ android:paddingTop="5dip"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:textSize="14sp"
+ android:textColor="#ffffffff" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+
+ <ImageButton
+ android:id="@+id/playpause"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:layout_marginLeft="16dip"
+ android:background="@drawable/btn_nowplaying_background_small"
+ android:src="@drawable/btn_playback_ic_play_small"
+ android:onClick="playPauseClicked"
+ />
+
+ </LinearLayout>
+ </LinearLayout>
+
+</LinearLayout>
+
Oops, something went wrong.

0 comments on commit 8d08ec2

Please sign in to comment.