Skip to content

Commit

Permalink
Backport the AudioPreview activity from Music2 to Music
Browse files Browse the repository at this point in the history
Change-Id: I1e1ec54a4613ef60e9a4539d5c50ed0874764b93
  • Loading branch information
marcone committed Sep 2, 2010
1 parent a51d6fe commit 8d08ec2
Show file tree
Hide file tree
Showing 30 changed files with 638 additions and 240 deletions.
2 changes: 2 additions & 0 deletions Android.mk
Expand Up @@ -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.
Expand Down
31 changes: 25 additions & 6 deletions AndroidManifest.xml
Expand Up @@ -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"/>
Expand All @@ -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" />
Expand All @@ -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" />
Expand Down
3 changes: 3 additions & 0 deletions proguard.flags
@@ -0,0 +1,3 @@
-keep class com.android.music.AudioPreview {
public void playPauseClicked(android.view.View);
}
52 changes: 52 additions & 0 deletions res/drawable-finger/progress_horizontal.xml
@@ -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>

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-hdpi/btn_playback_ic_pause_small.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-hdpi/btn_playback_ic_play_small.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-hdpi/btn_playback_small_normal.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-hdpi/btn_playback_small_pressed.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-hdpi/btn_playback_small_selected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/btn_playback_ic_pause_small.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/btn_playback_small_normal.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/btn_playback_small_pressed.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/btn_playback_small_selected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions res/drawable/btn_nowplaying_background_small.xml
@@ -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>
34 changes: 34 additions & 0 deletions res/drawable/seek_thumb.xml
@@ -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>
98 changes: 98 additions & 0 deletions res/layout-finger/audiopreview.xml
@@ -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>

0 comments on commit 8d08ec2

Please sign in to comment.