OSDN Git Service

theme engine fixes
authorAndrew <andrew.d.neal@gmail.com>
Tue, 17 Jan 2012 04:13:43 +0000 (22:13 -0600)
committerAndrew <andrew.d.neal@gmail.com>
Tue, 17 Jan 2012 04:13:43 +0000 (22:13 -0600)
47 files changed:
.classpath [new file with mode: 0644]
.project [new file with mode: 0644]
project.properties [new file with mode: 0644]
res/anim/anim_0.xml
res/anim/anim_1.xml
res/anim/anim_2.xml
res/anim/anim_3.xml
res/anim/anim_4.xml
res/anim/anim_5.xml
res/anim/fade_out_fast.xml
res/anim/peak_meter.xml
res/drawable/bg_stripes_repeat.xml
res/drawable/group_text_color.xml
res/drawable/list_selector_background.xml
res/drawable/now_playing_selector.xml
res/drawable/status_bg.xml
res/drawable/tabs_bg.xml
res/layout-land/audio_player.xml
res/layout-land/extra_controls.xml
res/layout/album_appwidget1x1.xml
res/layout/album_appwidget3x1.xml
res/layout/audio_player.xml
res/layout/do_not_show.xml
res/layout/extra_controls.xml
res/layout/nowplaying.xml
res/layout/statusbar.xml
res/layout/track_list_item_common.xml
res/layout/track_list_item_common_child.xml
res/menu/action_menu.xml
res/xml/appwidget3x1_info.xml
res/xml/appwidget4x2_info.xml
src/com/android/music/AlbumBrowserActivity.java
src/com/android/music/ArtistAlbumBrowserActivity.java
src/com/android/music/IMediaPlaybackService.aidl
src/com/android/music/MediaAppWidgetProvider1x1.java
src/com/android/music/MediaAppWidgetProvider3x1.java
src/com/android/music/MediaAppWidgetProvider4x1.java
src/com/android/music/MediaAppWidgetProvider4x2.java
src/com/android/music/MediaButtonIntentReceiver.java
src/com/android/music/MediaPlaybackActivity.java
src/com/android/music/MediaPlaybackService.java
src/com/android/music/MusicSettingsActivity.java
src/com/android/music/MusicViewPager.java
src/com/android/music/PlaylistBrowserActivity.java
src/com/android/music/Sensitivity.java
src/com/android/music/Shaker.java
src/com/android/music/TrackBrowserActivity.java

diff --git a/.classpath b/.classpath
new file mode 100644 (file)
index 0000000..8531be1
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+       <classpathentry kind="src" path="src"/>\r
+       <classpathentry kind="src" path="gen"/>\r
+       <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>\r
+       <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>\r
+       <classpathentry kind="lib" path="libs/android-support-v4.jar"/>\r
+       <classpathentry kind="output" path="bin/classes"/>\r
+</classpath>\r
diff --git a/.project b/.project
new file mode 100644 (file)
index 0000000..25e9b4c
--- /dev/null
+++ b/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+       <name>Music</name>\r
+       <comment></comment>\r
+       <projects>\r
+       </projects>\r
+       <buildSpec>\r
+               <buildCommand>\r
+                       <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+               <buildCommand>\r
+                       <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+               <buildCommand>\r
+                       <name>org.eclipse.jdt.core.javabuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+               <buildCommand>\r
+                       <name>com.android.ide.eclipse.adt.ApkBuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+       </buildSpec>\r
+       <natures>\r
+               <nature>com.android.ide.eclipse.adt.AndroidNature</nature>\r
+               <nature>org.eclipse.jdt.core.javanature</nature>\r
+       </natures>\r
+</projectDescription>\r
diff --git a/project.properties b/project.properties
new file mode 100644 (file)
index 0000000..8da376a
--- /dev/null
@@ -0,0 +1,11 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-15
index 3cf4b57..041113c 100644 (file)
@@ -1,13 +1,13 @@
-<?xml version="1.0" encoding="utf-8"?>
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-
-    <scale
-        android:duration="200"
-        android:fromXScale="2.0"
-        android:fromYScale="0.0"
-        android:pivotX="50.0%"
-        android:pivotY="50.0%"
-        android:toXScale="1.0"
-        android:toYScale="1.0" />
-
+<?xml version="1.0" encoding="utf-8"?>\r
+<set xmlns:android="http://schemas.android.com/apk/res/android" >\r
+\r
+    <scale\r
+        android:duration="200"\r
+        android:fromXScale="2.0"\r
+        android:fromYScale="0.0"\r
+        android:pivotX="50.0%"\r
+        android:pivotY="50.0%"\r
+        android:toXScale="1.0"\r
+        android:toYScale="1.0" />\r
+\r
 </set>
\ No newline at end of file
index 490de90..ac13fce 100644 (file)
@@ -1,13 +1,13 @@
-<?xml version="1.0" encoding="utf-8"?>
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-
-    <scale
-        android:duration="200"
-        android:fromXScale="2.0"
-        android:fromYScale="0.0"
-        android:pivotX="0.0%"
-        android:pivotY="50.0%"
-        android:toXScale="1.0"
-        android:toYScale="1.0" />
-
+<?xml version="1.0" encoding="utf-8"?>\r
+<set xmlns:android="http://schemas.android.com/apk/res/android" >\r
+\r
+    <scale\r
+        android:duration="200"\r
+        android:fromXScale="2.0"\r
+        android:fromYScale="0.0"\r
+        android:pivotX="0.0%"\r
+        android:pivotY="50.0%"\r
+        android:toXScale="1.0"\r
+        android:toYScale="1.0" />\r
+\r
 </set>
\ No newline at end of file
index b7c3e33..f1d15a6 100644 (file)
@@ -1,13 +1,13 @@
-<?xml version="1.0" encoding="utf-8"?>
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-
-    <scale
-        android:duration="200"
-        android:fromXScale="2.0"
-        android:fromYScale="0.0"
-        android:pivotX="00.0%"
-        android:pivotY="00.0%"
-        android:toXScale="1.0"
-        android:toYScale="1.0" />
-
+<?xml version="1.0" encoding="utf-8"?>\r
+<set xmlns:android="http://schemas.android.com/apk/res/android" >\r
+\r
+    <scale\r
+        android:duration="200"\r
+        android:fromXScale="2.0"\r
+        android:fromYScale="0.0"\r
+        android:pivotX="00.0%"\r
+        android:pivotY="00.0%"\r
+        android:toXScale="1.0"\r
+        android:toYScale="1.0" />\r
+\r
 </set>
\ No newline at end of file
index 5777b1d..7bda84b 100644 (file)
@@ -1,13 +1,13 @@
-<?xml version="1.0" encoding="utf-8"?>
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-
-    <scale
-        android:duration="200"
-        android:fromXScale="0.0"
-        android:fromYScale="2.0"
-        android:pivotX="50.0%"
-        android:pivotY="00.0%"
-        android:toXScale="1.0"
-        android:toYScale="1.0" />
-
+<?xml version="1.0" encoding="utf-8"?>\r
+<set xmlns:android="http://schemas.android.com/apk/res/android" >\r
+\r
+    <scale\r
+        android:duration="200"\r
+        android:fromXScale="0.0"\r
+        android:fromYScale="2.0"\r
+        android:pivotX="50.0%"\r
+        android:pivotY="00.0%"\r
+        android:toXScale="1.0"\r
+        android:toYScale="1.0" />\r
+\r
 </set>
\ No newline at end of file
index 8b33102..fda1a48 100644 (file)
@@ -1,14 +1,14 @@
-<?xml version="1.0" encoding="utf-8"?>
-<set xmlns:android="http://schemas.android.com/apk/res/android" >
-
-    <translate
-        android:duration="@android:integer/config_shortAnimTime"
-        android:fromYDelta="-50.0%p"
-        android:toYDelta="0.0" />
-
-    <alpha
-        android:duration="@android:integer/config_longAnimTime"
-        android:fromAlpha="0.0"
-        android:toAlpha="1.0" />
-
+<?xml version="1.0" encoding="utf-8"?>\r
+<set xmlns:android="http://schemas.android.com/apk/res/android" >\r
+\r
+    <translate\r
+        android:duration="@android:integer/config_shortAnimTime"\r
+        android:fromYDelta="-50.0%p"\r
+        android:toYDelta="0.0" />\r
+\r
+    <alpha\r
+        android:duration="@android:integer/config_longAnimTime"\r
+        android:fromAlpha="0.0"\r
+        android:toAlpha="1.0" />\r
+\r
 </set>
\ No newline at end of file
index 29613ab..8326cf7 100644 (file)
@@ -1,26 +1,26 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* //device/apps/common/res/anim/slide_in_right.xml
-**
-** Copyright 2007, 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.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android">
-        <translate android:fromXDelta="50%p" android:toXDelta="0"
-            android:duration="@android:integer/config_mediumAnimTime"/>
-        <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
-            android:duration="@android:integer/config_mediumAnimTime" />
+<?xml version="1.0" encoding="utf-8"?>\r
+<!--\r
+/* //device/apps/common/res/anim/slide_in_right.xml\r
+**\r
+** Copyright 2007, The Android Open Source Project\r
+**\r
+** Licensed under the Apache License, Version 2.0 (the "License");\r
+** you may not use this file except in compliance with the License.\r
+** You may obtain a copy of the License at\r
+**\r
+**     http://www.apache.org/licenses/LICENSE-2.0\r
+**\r
+** Unless required by applicable law or agreed to in writing, software\r
+** distributed under the License is distributed on an "AS IS" BASIS,\r
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+** See the License for the specific language governing permissions and\r
+** limitations under the License.\r
+*/\r
+-->\r
+\r
+<set xmlns:android="http://schemas.android.com/apk/res/android">\r
+        <translate android:fromXDelta="50%p" android:toXDelta="0"\r
+            android:duration="@android:integer/config_mediumAnimTime"/>\r
+        <alpha android:fromAlpha="0.0" android:toAlpha="1.0"\r
+            android:duration="@android:integer/config_mediumAnimTime" />\r
 </set>
\ No newline at end of file
index d946318..9d41aea 100644 (file)
@@ -1,23 +1,23 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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.
--->
-
-<alpha xmlns:android="http://schemas.android.com/apk/res/android"
-    android:interpolator="@android:anim/accelerate_interpolator"
-
-    android:fromAlpha="1.0"
-    android:toAlpha="0.0"
-
+<?xml version="1.0" encoding="utf-8"?>\r
+<!-- Copyright (C) 2009 The Android Open Source Project\r
+\r
+     Licensed under the Apache License, Version 2.0 (the "License");\r
+     you may not use this file except in compliance with the License.\r
+     You may obtain a copy of the License at\r
+\r
+          http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+     Unless required by applicable law or agreed to in writing, software\r
+     distributed under the License is distributed on an "AS IS" BASIS,\r
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+     See the License for the specific language governing permissions and\r
+     limitations under the License.\r
+-->\r
+\r
+<alpha xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:interpolator="@android:anim/accelerate_interpolator"\r
+\r
+    android:fromAlpha="1.0"\r
+    android:toAlpha="0.0"\r
+\r
     android:duration="@android:integer/config_mediumAnimTime" />
\ No newline at end of file
index e601eab..69b46a8 100644 (file)
@@ -1,18 +1,18 @@
-<?xml version="1.0" encoding="utf-8"?>
-<animation-list android:oneshot="false"
-  xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_1" />
-    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_2" />
-    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_4" />
-    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_3" />
-    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_4" />
-    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_3" />
-    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_2" />
-    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_4" />
-    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_5" />
-    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_4" />
-    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_3" />
-    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_2" />
-    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_1" />
-    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_3" />
-</animation-list>
+<?xml version="1.0" encoding="utf-8"?>\r
+<animation-list android:oneshot="false"\r
+  xmlns:android="http://schemas.android.com/apk/res/android">\r
+    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_1" />\r
+    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_2" />\r
+    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_4" />\r
+    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_3" />\r
+    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_4" />\r
+    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_3" />\r
+    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_2" />\r
+    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_4" />\r
+    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_5" />\r
+    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_4" />\r
+    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_3" />\r
+    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_2" />\r
+    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_1" />\r
+    <item android:duration="200" android:drawable="@drawable/indicator_playing_peak_meter_3" />\r
+</animation-list>\r
index af192e0..1d6f83d 100644 (file)
@@ -1,21 +1,21 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     Copyright (C) 2011 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.
-
--->
-
-<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
-    android:src="@drawable/bg_stripes"
-    android:tileMode="repeat" />
+<?xml version="1.0" encoding="utf-8"?>\r
+<!--\r
+     Copyright (C) 2011 The Android Open Source Project\r
+\r
+     Licensed under the Apache License, Version 2.0 (the "License");\r
+     you may not use this file except in compliance with the License.\r
+     You may obtain a copy of the License at\r
+\r
+          http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+     Unless required by applicable law or agreed to in writing, software\r
+     distributed under the License is distributed on an "AS IS" BASIS,\r
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+     See the License for the specific language governing permissions and\r
+     limitations under the License.\r
+\r
+-->\r
+\r
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:src="@drawable/bg_stripes"\r
+    android:tileMode="repeat" />\r
index 1020e42..6cc0130 100644 (file)
@@ -1,6 +1,6 @@
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-   <item android:state_focused="true" android:color="#ffffff"/>
-   <item android:state_pressed="true" android:state_enabled="false" android:color="#ffffff" />
-   <item android:state_enabled="false" android:color="#ffffff" />
-   <item android:color="#ff999999"/>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">\r
+   <item android:state_focused="true" android:color="#ffffff"/>\r
+   <item android:state_pressed="true" android:state_enabled="false" android:color="#ffffff" />\r
+   <item android:state_enabled="false" android:color="#ffffff" />\r
+   <item android:color="#ff999999"/>\r
  </selector>
\ No newline at end of file
index 5389bc7..a0eab9f 100644 (file)
@@ -27,7 +27,7 @@
         android:drawable="@drawable/playlist_tile_normal" />
 
     <item android:state_focused="true"
-        android:drawable="@color/ics_opaque" />
+        android:drawable="@drawable/playlist_tile_normal" />
 
     <item android:state_focused="false"
         android:drawable="@drawable/playlist_tile_normal" />
index 42df9bc..42512df 100644 (file)
@@ -1,19 +1,19 @@
-<?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" android:exitFadeDuration="@android:integer/config_mediumAnimTime">
-
-    <item android:drawable="@color/ics_opaque" android:state_pressed="true"/>
-    <item android:drawable="@color/ics_opaque" android:state_enabled="true" android:state_focused="true"/>
-    <item android:drawable="@drawable/now_playing_bg"/>
-
+<?xml version="1.0" encoding="utf-8"?>\r
+<!--\r
+     Copyright (C) 2010 The Android Open Source Project Licensed under the \r
+       Apache License, Version 2.0 (the "License"); you may not use this file except \r
+       in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 \r
+       Unless required by applicable law or agreed to in writing, software distributed \r
+       under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES \r
+       OR CONDITIONS OF ANY KIND, either express or implied. See the License for \r
+       the specific language governing permissions and limitations under the License.\r
+\r
+-->\r
+\r
+<selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_mediumAnimTime">\r
+\r
+    <item android:drawable="@color/ics_opaque" android:state_pressed="true"/>\r
+    <item android:drawable="@color/ics_opaque" android:state_enabled="true" android:state_focused="true"/>\r
+    <item android:drawable="@drawable/now_playing_bg"/>\r
+\r
 </selector>
\ No newline at end of file
index c2cdf2f..99e5ea6 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
-    android:src="@drawable/notify_panel_notification_icon_bg"
-    android:tileMode="repeat" />
+<?xml version="1.0" encoding="utf-8"?>\r
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:src="@drawable/notify_panel_notification_icon_bg"\r
+    android:tileMode="repeat" />\r
index 260370d..bd717fb 100644 (file)
@@ -1,9 +1,9 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <item android:drawable="@drawable/btn_tab_blue" android:state_pressed="true"/>
-    <item android:drawable="@drawable/btn_tab_blue" android:state_enabled="true" android:state_focused="true"/>
-    <item android:drawable="@drawable/btn_tab_selected" android:state_selected="true"/>
-    <item android:drawable="@drawable/btn_tab_default"/>
-
+<?xml version="1.0" encoding="utf-8"?>\r
+<selector xmlns:android="http://schemas.android.com/apk/res/android">\r
+\r
+    <item android:drawable="@drawable/btn_tab_blue" android:state_pressed="true"/>\r
+    <item android:drawable="@drawable/btn_tab_blue" android:state_enabled="true" android:state_focused="true"/>\r
+    <item android:drawable="@drawable/btn_tab_selected" android:state_selected="true"/>\r
+    <item android:drawable="@drawable/btn_tab_default"/>\r
+\r
 </selector>
\ No newline at end of file
index b5ce353..4de244f 100644 (file)
@@ -16,6 +16,7 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/now_playing_bg"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@drawable/player_background"
index 1ff6382..3dabffd 100644 (file)
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/extra_controls"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:layout_below="@id/album"
-    android:layout_gravity="fill_vertical"
-    android:background="@null"
-    android:visibility="gone"
-    android:weightSum="6.25" >
-
-    <LinearLayout
-        android:id="@+id/shuffle"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1.25"
-        android:background="@drawable/btn_bg_extra"
-        android:clickable="true"
-        android:gravity="center"
-        android:orientation="vertical" >
-
-        <ImageButton
-            android:id="@+id/shuffle_extra_image"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:background="@null"
-            android:clickable="false" />
-
-        <TextView
-            android:id="@+id/shuffle_text"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="2.0dip"
-            android:gravity="center_horizontal"
-            android:shadowColor="#ff111111"
-            android:text="@string/shuffle_extra"
-            android:textColor="#ffffffff"
-            android:textSize="12.0dip"
-            android:textStyle="bold" />
-    </LinearLayout>
-
-    <LinearLayout
-        android:id="@+id/repeat"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1.25"
-        android:background="@drawable/btn_bg_extra"
-        android:clickable="true"
-        android:gravity="center"
-        android:longClickable="true"
-        android:orientation="vertical" >
-
-        <ImageButton
-            android:id="@+id/repeat_extra_image"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:background="@null"
-            android:clickable="false" />
-
-        <TextView
-            android:id="@+id/repeat_text"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="2.0dip"
-            android:gravity="center_horizontal"
-            android:shadowColor="#ff111111"
-            android:text="@string/repeat_extra"
-            android:textColor="#ffffffff"
-            android:textSize="12.0dip"
-            android:textStyle="bold" />
-    </LinearLayout>
-
-    <!-- Landscape -->
-
-    <LinearLayout
-        android:id="@+id/shop"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1.25"
-        android:background="@drawable/btn_bg_extra"
-        android:clickable="true"
-        android:gravity="center"
-        android:orientation="vertical"
-        android:visibility="gone" >
-
-        <ImageButton
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:background="@null"
-            android:clickable="false"
-            android:src="@drawable/ic_market" />
-
-        <TextView
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="2.0dip"
-            android:gravity="center_horizontal"
-            android:shadowColor="#ff111111"
-            android:text="@string/shop_min"
-            android:textColor="#ffffffff"
-            android:textSize="12.0dip"
-            android:textStyle="bold" />
-    </LinearLayout>
-
-    <LinearLayout
-        android:id="@+id/ringtone"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1.25"
-        android:background="@drawable/btn_bg_extra"
-        android:clickable="true"
-        android:gravity="center"
-        android:orientation="vertical"
-        android:visibility="gone" >
-
-        <ImageButton
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:background="@null"
-            android:clickable="false"
-            android:src="@drawable/ic_ring" />
-
-        <TextView
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="2.0dip"
-            android:gravity="center_horizontal"
-            android:shadowColor="#ff111111"
-            android:text="@string/set_ring"
-            android:textColor="#ffffffff"
-            android:textSize="12.0dip"
-            android:textStyle="bold" />
-    </LinearLayout>
-
-    <LinearLayout
-        android:id="@+id/share_extra"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1.25"
-        android:background="@drawable/btn_bg_extra"
-        android:clickable="true"
-        android:gravity="center"
-        android:longClickable="true"
-        android:orientation="vertical" >
-
-        <ImageButton
-            android:id="@+id/share_extra_image"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:background="@null"
-            android:clickable="false"
-            android:src="@drawable/ic_menu_share" />
-
-        <TextView
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="2.0dip"
-            android:gravity="center_horizontal"
-            android:shadowColor="#ff111111"
-            android:text="@string/share"
-            android:textColor="#ffffffff"
-            android:textSize="12.0dip"
-            android:textStyle="bold" />
-    </LinearLayout>
-
-    <LinearLayout
-        android:id="@+id/eq_extra"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1.25"
-        android:background="@drawable/btn_bg_extra"
-        android:clickable="true"
-        android:gravity="center"
-        android:orientation="vertical" >
-
-        <ImageButton
-            android:id="@+id/eq_extra_image"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:background="@null"
-            android:clickable="false"
-            android:src="@drawable/ic_menu_eq" />
-
-        <TextView
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="2.0dip"
-            android:gravity="center_horizontal"
-            android:shadowColor="#ff111111"
-            android:text="@string/eq"
-            android:textColor="#ffffffff"
-            android:textSize="12.0dip"
-            android:textStyle="bold" />
-    </LinearLayout>
-
-    <LinearLayout
-        android:id="@+id/delete_extra"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1.25"
-        android:background="@drawable/btn_bg_extra"
-        android:clickable="true"
-        android:gravity="center"
-        android:orientation="vertical"
-        android:visibility="gone" >
-
-        <ImageButton
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:background="@null"
-            android:clickable="false"
-            android:src="@drawable/ic_menu_delete" />
-
-        <TextView
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="2.0dip"
-            android:gravity="center_horizontal"
-            android:shadowColor="#ff111111"
-            android:text="@string/delete_track"
-            android:textColor="#ffffffff"
-            android:textSize="12.0dip"
-            android:textStyle="bold" />
-    </LinearLayout>
-
+<?xml version="1.0" encoding="utf-8"?>\r
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:id="@+id/extra_controls"\r
+    android:layout_width="fill_parent"\r
+    android:layout_height="fill_parent"\r
+    android:layout_below="@id/album"\r
+    android:layout_gravity="fill_vertical"\r
+    android:background="@null"\r
+    android:visibility="gone"\r
+    android:weightSum="6.25" >\r
+\r
+    <LinearLayout\r
+        android:id="@+id/shuffle"\r
+        android:layout_width="fill_parent"\r
+        android:layout_height="wrap_content"\r
+        android:layout_weight="1.25"\r
+        android:background="@drawable/btn_bg_extra"\r
+        android:clickable="true"\r
+        android:gravity="center"\r
+        android:orientation="vertical" >\r
+\r
+        <ImageButton\r
+            android:id="@+id/shuffle_extra_image"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:background="@null"\r
+            android:clickable="false" />\r
+\r
+        <TextView\r
+            android:id="@+id/shuffle_text"\r
+            android:layout_width="fill_parent"\r
+            android:layout_height="wrap_content"\r
+            android:layout_marginTop="2.0dip"\r
+            android:gravity="center_horizontal"\r
+            android:shadowColor="#ff111111"\r
+            android:text="@string/shuffle_extra"\r
+            android:textColor="#ffffffff"\r
+            android:textSize="12.0dip"\r
+            android:textStyle="bold" />\r
+    </LinearLayout>\r
+\r
+    <LinearLayout\r
+        android:id="@+id/repeat"\r
+        android:layout_width="fill_parent"\r
+        android:layout_height="wrap_content"\r
+        android:layout_weight="1.25"\r
+        android:background="@drawable/btn_bg_extra"\r
+        android:clickable="true"\r
+        android:gravity="center"\r
+        android:longClickable="true"\r
+        android:orientation="vertical" >\r
+\r
+        <ImageButton\r
+            android:id="@+id/repeat_extra_image"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:background="@null"\r
+            android:clickable="false" />\r
+\r
+        <TextView\r
+            android:id="@+id/repeat_text"\r
+            android:layout_width="fill_parent"\r
+            android:layout_height="wrap_content"\r
+            android:layout_marginTop="2.0dip"\r
+            android:gravity="center_horizontal"\r
+            android:shadowColor="#ff111111"\r
+            android:text="@string/repeat_extra"\r
+            android:textColor="#ffffffff"\r
+            android:textSize="12.0dip"\r
+            android:textStyle="bold" />\r
+    </LinearLayout>\r
+\r
+    <!-- Landscape -->\r
+\r
+    <LinearLayout\r
+        android:id="@+id/shop"\r
+        android:layout_width="fill_parent"\r
+        android:layout_height="wrap_content"\r
+        android:layout_weight="1.25"\r
+        android:background="@drawable/btn_bg_extra"\r
+        android:clickable="true"\r
+        android:gravity="center"\r
+        android:orientation="vertical"\r
+        android:visibility="gone" >\r
+\r
+        <ImageButton\r
+            android:id="@+id/shop_button"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:background="@null"\r
+            android:clickable="false"\r
+            android:src="@drawable/ic_market" />\r
+\r
+        <TextView\r
+            android:layout_width="fill_parent"\r
+            android:layout_height="wrap_content"\r
+            android:layout_marginTop="2.0dip"\r
+            android:gravity="center_horizontal"\r
+            android:shadowColor="#ff111111"\r
+            android:text="@string/shop_min"\r
+            android:textColor="#ffffffff"\r
+            android:textSize="12.0dip"\r
+            android:textStyle="bold" />\r
+    </LinearLayout>\r
+\r
+    <LinearLayout\r
+        android:id="@+id/ringtone"\r
+        android:layout_width="fill_parent"\r
+        android:layout_height="wrap_content"\r
+        android:layout_weight="1.25"\r
+        android:background="@drawable/btn_bg_extra"\r
+        android:clickable="true"\r
+        android:gravity="center"\r
+        android:orientation="vertical"\r
+        android:visibility="gone" >\r
+\r
+        <ImageButton\r
+            android:id="@+id/ring_button"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:background="@null"\r
+            android:clickable="false"\r
+            android:src="@drawable/ic_ring" />\r
+\r
+        <TextView\r
+            android:layout_width="fill_parent"\r
+            android:layout_height="wrap_content"\r
+            android:layout_marginTop="2.0dip"\r
+            android:gravity="center_horizontal"\r
+            android:shadowColor="#ff111111"\r
+            android:text="@string/set_ring"\r
+            android:textColor="#ffffffff"\r
+            android:textSize="12.0dip"\r
+            android:textStyle="bold" />\r
+    </LinearLayout>\r
+\r
+    <LinearLayout\r
+        android:id="@+id/share_extra"\r
+        android:layout_width="fill_parent"\r
+        android:layout_height="wrap_content"\r
+        android:layout_weight="1.25"\r
+        android:background="@drawable/btn_bg_extra"\r
+        android:clickable="true"\r
+        android:gravity="center"\r
+        android:longClickable="true"\r
+        android:orientation="vertical" >\r
+\r
+        <ImageButton\r
+            android:id="@+id/share_extra_image"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:background="@null"\r
+            android:clickable="false"\r
+            android:src="@drawable/ic_menu_share" />\r
+\r
+        <TextView\r
+            android:layout_width="fill_parent"\r
+            android:layout_height="wrap_content"\r
+            android:layout_marginTop="2.0dip"\r
+            android:gravity="center_horizontal"\r
+            android:shadowColor="#ff111111"\r
+            android:text="@string/share"\r
+            android:textColor="#ffffffff"\r
+            android:textSize="12.0dip"\r
+            android:textStyle="bold" />\r
+    </LinearLayout>\r
+\r
+    <LinearLayout\r
+        android:id="@+id/eq_extra"\r
+        android:layout_width="fill_parent"\r
+        android:layout_height="wrap_content"\r
+        android:layout_weight="1.25"\r
+        android:background="@drawable/btn_bg_extra"\r
+        android:clickable="true"\r
+        android:gravity="center"\r
+        android:orientation="vertical" >\r
+\r
+        <ImageButton\r
+            android:id="@+id/eq_extra_image"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:background="@null"\r
+            android:clickable="false"\r
+            android:src="@drawable/ic_menu_eq" />\r
+\r
+        <TextView\r
+            android:layout_width="fill_parent"\r
+            android:layout_height="wrap_content"\r
+            android:layout_marginTop="2.0dip"\r
+            android:gravity="center_horizontal"\r
+            android:shadowColor="#ff111111"\r
+            android:text="@string/eq"\r
+            android:textColor="#ffffffff"\r
+            android:textSize="12.0dip"\r
+            android:textStyle="bold" />\r
+    </LinearLayout>\r
+\r
+    <LinearLayout\r
+        android:id="@+id/delete_extra"\r
+        android:layout_width="fill_parent"\r
+        android:layout_height="wrap_content"\r
+        android:layout_weight="1.25"\r
+        android:background="@drawable/btn_bg_extra"\r
+        android:clickable="true"\r
+        android:gravity="center"\r
+        android:orientation="vertical"\r
+        android:visibility="gone" >\r
+\r
+        <ImageButton\r
+            android:id="@+id/delete_button"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:background="@null"\r
+            android:clickable="false"\r
+            android:src="@drawable/ic_menu_delete" />\r
+\r
+        <TextView\r
+            android:layout_width="fill_parent"\r
+            android:layout_height="wrap_content"\r
+            android:layout_marginTop="2.0dip"\r
+            android:gravity="center_horizontal"\r
+            android:shadowColor="#ff111111"\r
+            android:text="@string/delete_track"\r
+            android:textColor="#ffffffff"\r
+            android:textSize="12.0dip"\r
+            android:textStyle="bold" />\r
+    </LinearLayout>\r
+\r
 </LinearLayout>
\ No newline at end of file
index 5ab05f1..a46105e 100644 (file)
@@ -1,21 +1,21 @@
-<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/content"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent" >
-
-    <ImageView
-        android:id="@+id/albumart"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
-        android:adjustViewBounds="true" />
-
-    <ImageView
-        android:id="@+id/play_pause"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center"
-        android:padding="6.0dip"
-        android:src="@drawable/appwidget_play_normal" />
-
+<?xml version="1.0" encoding="utf-8"?>\r
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:id="@+id/content"\r
+    android:layout_width="fill_parent"\r
+    android:layout_height="fill_parent" >\r
+\r
+    <ImageView\r
+        android:id="@+id/albumart"\r
+        android:layout_width="fill_parent"\r
+        android:layout_height="fill_parent"\r
+        android:adjustViewBounds="true" />\r
+\r
+    <ImageView\r
+        android:id="@+id/play_pause"\r
+        android:layout_width="wrap_content"\r
+        android:layout_height="wrap_content"\r
+        android:layout_gravity="center"\r
+        android:padding="6.0dip"\r
+        android:src="@drawable/appwidget_play_normal" />\r
+\r
 </FrameLayout>
\ No newline at end of file
index f9ffde0..55aea60 100644 (file)
@@ -1,35 +1,35 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:background="@drawable/appwidget_bg"
-    android:orientation="horizontal" >
-
-    <ImageView
-        android:id="@+id/albumart"
-        android:layout_width="0dip"
-        android:layout_height="match_parent"
-        android:layout_weight="1.5"
-        android:adjustViewBounds="true"
-        android:scaleType="fitXY"
-        android:src="@drawable/appwidget_play_normal" />
-
-    <ImageView
-        android:id="@+id/previous"
-        android:layout_width="0dip"
-        android:layout_height="match_parent"
-        android:layout_weight="1.0"
-        android:background="@drawable/btn_bg"
-        android:scaleType="center"
-        android:src="@drawable/ic_appwidget_music_prev" />
-
-    <ImageView
-        android:id="@+id/next"
-        android:layout_width="0dip"
-        android:layout_height="match_parent"
-        android:layout_weight="1.0"
-        android:background="@drawable/btn_bg"
-        android:scaleType="center"
-        android:src="@drawable/ic_appwidget_music_next" />
-
+<?xml version="1.0" encoding="utf-8"?>\r
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:layout_width="match_parent"\r
+    android:layout_height="match_parent"\r
+    android:background="@drawable/appwidget_bg"\r
+    android:orientation="horizontal" >\r
+\r
+    <ImageView\r
+        android:id="@+id/albumart"\r
+        android:layout_width="0dip"\r
+        android:layout_height="match_parent"\r
+        android:layout_weight="1.5"\r
+        android:adjustViewBounds="true"\r
+        android:scaleType="fitXY"\r
+        android:src="@drawable/appwidget_play_normal" />\r
+\r
+    <ImageView\r
+        android:id="@+id/previous"\r
+        android:layout_width="0dip"\r
+        android:layout_height="match_parent"\r
+        android:layout_weight="1.0"\r
+        android:background="@drawable/btn_bg"\r
+        android:scaleType="center"\r
+        android:src="@drawable/ic_appwidget_music_prev" />\r
+\r
+    <ImageView\r
+        android:id="@+id/next"\r
+        android:layout_width="0dip"\r
+        android:layout_height="match_parent"\r
+        android:layout_weight="1.0"\r
+        android:background="@drawable/btn_bg"\r
+        android:scaleType="center"\r
+        android:src="@drawable/ic_appwidget_music_next" />\r
+\r
 </LinearLayout>
\ No newline at end of file
index 1f39ef1..b86cf90 100644 (file)
@@ -16,6 +16,7 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/now_playing_bg"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@drawable/player_background"
index bea5ef9..bd7d6ef 100644 (file)
@@ -1,15 +1,15 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/do_not_show"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:orientation="horizontal"
-    android:padding="10dp" >
-
-    <CheckBox
-        android:id="@+id/noShow"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="Do not show again" >
-    </CheckBox>
-
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:id="@+id/do_not_show"\r
+    android:layout_width="fill_parent"\r
+    android:layout_height="fill_parent"\r
+    android:orientation="horizontal"\r
+    android:padding="10dp" >\r
+\r
+    <CheckBox\r
+        android:id="@+id/noShow"\r
+        android:layout_width="wrap_content"\r
+        android:layout_height="wrap_content"\r
+        android:text="Do not show again" >\r
+    </CheckBox>\r
+\r
 </LinearLayout>
\ No newline at end of file
index 574a950..4f85fdb 100644 (file)
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/extra_controls"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:layout_below="@id/album"
-    android:layout_gravity="fill_vertical"
-    android:visibility="gone"
-    android:weightSum="5.0" >
-
-    <LinearLayout
-        android:id="@+id/shuffle"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1.25"
-        android:background="@drawable/btn_bg_extra"
-        android:clickable="true"
-        android:gravity="center"
-        android:orientation="vertical" >
-
-        <ImageButton
-            android:id="@+id/shuffle_extra_image"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:background="@null"
-            android:clickable="false" />
-
-        <TextView
-            android:id="@+id/shuffle_text"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="2.0dip"
-            android:gravity="center_horizontal"
-            android:shadowColor="#ff111111"
-            android:text="@string/shuffle_extra"
-            android:textColor="#ffffffff"
-            android:textSize="12.0dip"
-            android:textStyle="bold" />
-    </LinearLayout>
-
-    <LinearLayout
-        android:id="@+id/repeat"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1.25"
-        android:background="@drawable/btn_bg_extra"
-        android:clickable="true"
-        android:gravity="center"
-        android:longClickable="true"
-        android:orientation="vertical" >
-
-        <ImageButton
-            android:id="@+id/repeat_extra_image"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:background="@null"
-            android:clickable="false" />
-
-        <TextView
-            android:id="@+id/repeat_text"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="2.0dip"
-            android:gravity="center_horizontal"
-            android:shadowColor="#ff111111"
-            android:text="@string/repeat_extra"
-            android:textColor="#ffffffff"
-            android:textSize="12.0dip"
-            android:textStyle="bold" />
-    </LinearLayout>
-
-    <!-- Landscape -->
-
-    <LinearLayout
-        android:id="@+id/shop"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1.25"
-        android:background="@drawable/btn_bg_extra"
-        android:clickable="true"
-        android:gravity="center"
-        android:orientation="vertical"
-        android:visibility="gone" >
-
-        <ImageButton
-            android:id="@+id/shop_button"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:background="@null"
-            android:clickable="false"
-            android:src="@drawable/ic_market" />
-
-        <TextView
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="2.0dip"
-            android:gravity="center_horizontal"
-            android:shadowColor="#ff111111"
-            android:text="@string/shop_min"
-            android:textColor="#ffffffff"
-            android:textSize="12.0dip"
-            android:textStyle="bold" />
-    </LinearLayout>
-
-    <LinearLayout
-        android:id="@+id/ringtone"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1.25"
-        android:background="@drawable/btn_bg_extra"
-        android:clickable="true"
-        android:gravity="center"
-        android:orientation="vertical"
-        android:visibility="gone" >
-
-        <ImageButton
-            android:id="@+id/ring_button"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:background="@null"
-            android:clickable="false"
-            android:src="@drawable/ic_ring" />
-
-        <TextView
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="2.0dip"
-            android:gravity="center_horizontal"
-            android:shadowColor="#ff111111"
-            android:text="@string/set_ring"
-            android:textColor="#ffffffff"
-            android:textSize="12.0dip"
-            android:textStyle="bold" />
-    </LinearLayout>
-
-    <LinearLayout
-        android:id="@+id/share_extra"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1.25"
-        android:background="@drawable/btn_bg_extra"
-        android:clickable="true"
-        android:gravity="center"
-        android:longClickable="true"
-        android:orientation="vertical" >
-
-        <ImageButton
-            android:id="@+id/share_extra_image"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:background="@null"
-            android:clickable="false"
-            android:src="@drawable/ic_menu_share" />
-
-        <TextView
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="2.0dip"
-            android:gravity="center_horizontal"
-            android:shadowColor="#ff111111"
-            android:text="@string/share"
-            android:textColor="#ffffffff"
-            android:textSize="12.0dip"
-            android:textStyle="bold" />
-    </LinearLayout>
-
-    <LinearLayout
-        android:id="@+id/eq_extra"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1.25"
-        android:background="@drawable/btn_bg_extra"
-        android:clickable="true"
-        android:gravity="center"
-        android:orientation="vertical" >
-
-        <ImageButton
-            android:id="@+id/eq_extra_image"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:background="@null"
-            android:clickable="false"
-            android:src="@drawable/ic_menu_eq" />
-
-        <TextView
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="2.0dip"
-            android:gravity="center_horizontal"
-            android:shadowColor="#ff111111"
-            android:text="@string/eq"
-            android:textColor="#ffffffff"
-            android:textSize="12.0dip"
-            android:textStyle="bold" />
-    </LinearLayout>
-
-    <LinearLayout
-        android:id="@+id/delete_extra"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1.25"
-        android:background="@drawable/btn_bg_extra"
-        android:clickable="true"
-        android:gravity="center"
-        android:orientation="vertical"
-        android:visibility="gone" >
-
-        <ImageButton
-            android:id="@+id/delete_button"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:background="@null"
-            android:clickable="false"
-            android:src="@drawable/ic_menu_delete" />
-
-        <TextView
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="2.0dip"
-            android:gravity="center_horizontal"
-            android:shadowColor="#ff111111"
-            android:text="@string/delete_track"
-            android:textColor="#ffffffff"
-            android:textSize="12.0dip"
-            android:textStyle="bold" />
-    </LinearLayout>
-
+<?xml version="1.0" encoding="utf-8"?>\r
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:id="@+id/extra_controls"\r
+    android:layout_width="fill_parent"\r
+    android:layout_height="fill_parent"\r
+    android:layout_below="@id/album"\r
+    android:layout_gravity="fill_vertical"\r
+    android:visibility="gone"\r
+    android:weightSum="5.0" >\r
+\r
+    <LinearLayout\r
+        android:id="@+id/shuffle"\r
+        android:layout_width="fill_parent"\r
+        android:layout_height="wrap_content"\r
+        android:layout_weight="1.25"\r
+        android:background="@drawable/btn_bg_extra"\r
+        android:clickable="true"\r
+        android:gravity="center"\r
+        android:orientation="vertical" >\r
+\r
+        <ImageButton\r
+            android:id="@+id/shuffle_extra_image"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:background="@null"\r
+            android:clickable="false" />\r
+\r
+        <TextView\r
+            android:id="@+id/shuffle_text"\r
+            android:layout_width="fill_parent"\r
+            android:layout_height="wrap_content"\r
+            android:layout_marginTop="2.0dip"\r
+            android:gravity="center_horizontal"\r
+            android:shadowColor="#ff111111"\r
+            android:text="@string/shuffle_extra"\r
+            android:textColor="#ffffffff"\r
+            android:textSize="12.0dip"\r
+            android:textStyle="bold" />\r
+    </LinearLayout>\r
+\r
+    <LinearLayout\r
+        android:id="@+id/repeat"\r
+        android:layout_width="fill_parent"\r
+        android:layout_height="wrap_content"\r
+        android:layout_weight="1.25"\r
+        android:background="@drawable/btn_bg_extra"\r
+        android:clickable="true"\r
+        android:gravity="center"\r
+        android:longClickable="true"\r
+        android:orientation="vertical" >\r
+\r
+        <ImageButton\r
+            android:id="@+id/repeat_extra_image"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:background="@null"\r
+            android:clickable="false" />\r
+\r
+        <TextView\r
+            android:id="@+id/repeat_text"\r
+            android:layout_width="fill_parent"\r
+            android:layout_height="wrap_content"\r
+            android:layout_marginTop="2.0dip"\r
+            android:gravity="center_horizontal"\r
+            android:shadowColor="#ff111111"\r
+            android:text="@string/repeat_extra"\r
+            android:textColor="#ffffffff"\r
+            android:textSize="12.0dip"\r
+            android:textStyle="bold" />\r
+    </LinearLayout>\r
+\r
+    <!-- Landscape -->\r
+\r
+    <LinearLayout\r
+        android:id="@+id/shop"\r
+        android:layout_width="fill_parent"\r
+        android:layout_height="wrap_content"\r
+        android:layout_weight="1.25"\r
+        android:background="@drawable/btn_bg_extra"\r
+        android:clickable="true"\r
+        android:gravity="center"\r
+        android:orientation="vertical"\r
+        android:visibility="gone" >\r
+\r
+        <ImageButton\r
+            android:id="@+id/shop_button"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:background="@null"\r
+            android:clickable="false"\r
+            android:src="@drawable/ic_market" />\r
+\r
+        <TextView\r
+            android:layout_width="fill_parent"\r
+            android:layout_height="wrap_content"\r
+            android:layout_marginTop="2.0dip"\r
+            android:gravity="center_horizontal"\r
+            android:shadowColor="#ff111111"\r
+            android:text="@string/shop_min"\r
+            android:textColor="#ffffffff"\r
+            android:textSize="12.0dip"\r
+            android:textStyle="bold" />\r
+    </LinearLayout>\r
+\r
+    <LinearLayout\r
+        android:id="@+id/ringtone"\r
+        android:layout_width="fill_parent"\r
+        android:layout_height="wrap_content"\r
+        android:layout_weight="1.25"\r
+        android:background="@drawable/btn_bg_extra"\r
+        android:clickable="true"\r
+        android:gravity="center"\r
+        android:orientation="vertical"\r
+        android:visibility="gone" >\r
+\r
+        <ImageButton\r
+            android:id="@+id/ring_button"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:background="@null"\r
+            android:clickable="false"\r
+            android:src="@drawable/ic_ring" />\r
+\r
+        <TextView\r
+            android:layout_width="fill_parent"\r
+            android:layout_height="wrap_content"\r
+            android:layout_marginTop="2.0dip"\r
+            android:gravity="center_horizontal"\r
+            android:shadowColor="#ff111111"\r
+            android:text="@string/set_ring"\r
+            android:textColor="#ffffffff"\r
+            android:textSize="12.0dip"\r
+            android:textStyle="bold" />\r
+    </LinearLayout>\r
+\r
+    <LinearLayout\r
+        android:id="@+id/share_extra"\r
+        android:layout_width="fill_parent"\r
+        android:layout_height="wrap_content"\r
+        android:layout_weight="1.25"\r
+        android:background="@drawable/btn_bg_extra"\r
+        android:clickable="true"\r
+        android:gravity="center"\r
+        android:longClickable="true"\r
+        android:orientation="vertical" >\r
+\r
+        <ImageButton\r
+            android:id="@+id/share_extra_image"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:background="@null"\r
+            android:clickable="false"\r
+            android:src="@drawable/ic_menu_share" />\r
+\r
+        <TextView\r
+            android:layout_width="fill_parent"\r
+            android:layout_height="wrap_content"\r
+            android:layout_marginTop="2.0dip"\r
+            android:gravity="center_horizontal"\r
+            android:shadowColor="#ff111111"\r
+            android:text="@string/share"\r
+            android:textColor="#ffffffff"\r
+            android:textSize="12.0dip"\r
+            android:textStyle="bold" />\r
+    </LinearLayout>\r
+\r
+    <LinearLayout\r
+        android:id="@+id/eq_extra"\r
+        android:layout_width="fill_parent"\r
+        android:layout_height="wrap_content"\r
+        android:layout_weight="1.25"\r
+        android:background="@drawable/btn_bg_extra"\r
+        android:clickable="true"\r
+        android:gravity="center"\r
+        android:orientation="vertical" >\r
+\r
+        <ImageButton\r
+            android:id="@+id/eq_extra_image"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:background="@null"\r
+            android:clickable="false"\r
+            android:src="@drawable/ic_menu_eq" />\r
+\r
+        <TextView\r
+            android:layout_width="fill_parent"\r
+            android:layout_height="wrap_content"\r
+            android:layout_marginTop="2.0dip"\r
+            android:gravity="center_horizontal"\r
+            android:shadowColor="#ff111111"\r
+            android:text="@string/eq"\r
+            android:textColor="#ffffffff"\r
+            android:textSize="12.0dip"\r
+            android:textStyle="bold" />\r
+    </LinearLayout>\r
+\r
+    <LinearLayout\r
+        android:id="@+id/delete_extra"\r
+        android:layout_width="fill_parent"\r
+        android:layout_height="wrap_content"\r
+        android:layout_weight="1.25"\r
+        android:background="@drawable/btn_bg_extra"\r
+        android:clickable="true"\r
+        android:gravity="center"\r
+        android:orientation="vertical"\r
+        android:visibility="gone" >\r
+\r
+        <ImageButton\r
+            android:id="@+id/delete_button"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:background="@null"\r
+            android:clickable="false"\r
+            android:src="@drawable/ic_menu_delete" />\r
+\r
+        <TextView\r
+            android:layout_width="fill_parent"\r
+            android:layout_height="wrap_content"\r
+            android:layout_marginTop="2.0dip"\r
+            android:gravity="center_horizontal"\r
+            android:shadowColor="#ff111111"\r
+            android:text="@string/delete_track"\r
+            android:textColor="#ffffffff"\r
+            android:textSize="12.0dip"\r
+            android:textStyle="bold" />\r
+    </LinearLayout>\r
+\r
 </LinearLayout>
\ No newline at end of file
index 762a5fa..54754e2 100644 (file)
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/nowplaying"
-    android:layout_width="fill_parent"
-    android:layout_height="54.0dip"
-    android:background="@drawable/np_bg"
-    android:focusable="true"
-    android:orientation="vertical" >
-
-    <ImageView
-        android:id="@+id/info_divider"
-        android:layout_width="match_parent"
-        android:layout_height="1dip"
-        android:background="@color/ics"
-        android:scaleType="fitXY" />
-
-    <ProgressBar
-        android:id="@+id/progress"
-        style="?android:attr/progressBarStyleHorizontal"
-        android:layout_width="match_parent"
-        android:layout_height="5dip"
-        android:progressDrawable="@drawable/progress_horizontal"
-        android:visibility="gone" />
-
-    <LinearLayout
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
-        android:orientation="horizontal" >
-
-        <ImageView
-            android:id="@+id/now_playing_albumart"
-            android:layout_width="54.0dip"
-            android:layout_height="match_parent"
-            android:layout_gravity="left|center"
-            android:adjustViewBounds="true"
-            android:scaleType="fitXY" />
-
-        <LinearLayout
-            android:layout_width="0.0dip"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center_vertical"
-            android:layout_weight="1.0"
-            android:orientation="vertical" >
-
-            <TextView
-                android:id="@+id/now_playing_title"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginLeft="7.0dip"
-                android:ellipsize="end"
-                android:singleLine="true"
-                android:textAppearance="?android:textAppearanceSmall"
-                android:textColor="#dadada"
-                android:textSize="10.0sp"
-                android:textStyle="bold" />
-
-            <TextView
-                android:id="@+id/now_playing_artist"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginLeft="7.0dip"
-                android:ellipsize="end"
-                android:singleLine="true"
-                android:textAppearance="?android:textAppearanceSmall"
-                android:textColor="#ff999999"
-                android:textSize="9.0sp" />
-
-            <TextView
-                android:id="@+id/now_playing_albumname"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginLeft="7.0dip"
-                android:ellipsize="end"
-                android:singleLine="true"
-                android:textAppearance="?android:textAppearanceSmall"
-                android:textColor="#ff999999"
-                android:textSize="9.0sp" />
-        </LinearLayout>
-
-        <ImageView
-            android:id="@id/icon"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center_vertical"
-            android:layout_marginLeft="16.0dip" />
-
-        <ImageButton
-            android:id="@+id/media_prev"
-            android:layout_width="56dip"
-            android:layout_height="match_parent"
-            android:layout_gravity="center|right"
-            android:background="@drawable/btn_bg"
-            android:src="@drawable/ic_appwidget_music_prev"
-            android:visibility="gone" />
-
-        <ImageButton
-            android:id="@+id/media_play"
-            android:layout_width="56dip"
-            android:layout_height="match_parent"
-            android:layout_gravity="center|right"
-            android:background="@drawable/btn_bg"
-            android:src="@drawable/ic_appwidget_music_play"
-            android:visibility="gone" />
-
-        <ImageButton
-            android:id="@+id/media_next"
-            android:layout_width="56dip"
-            android:layout_height="match_parent"
-            android:layout_gravity="center|right"
-            android:background="@drawable/btn_bg"
-            android:src="@drawable/ic_appwidget_music_next"
-            android:visibility="gone" />
-
-        <ImageButton
-            android:id="@+id/plus_playlist"
-            android:layout_width="56dip"
-            android:layout_height="match_parent"
-            android:layout_gravity="center|right"
-            android:background="@drawable/btn_bg"
-            android:src="@drawable/ic_menu_add_playlist" />
-
-        <ImageButton
-            android:id="@+id/share_song"
-            android:layout_width="56dip"
-            android:layout_height="match_parent"
-            android:layout_gravity="center|right"
-            android:background="@drawable/btn_bg"
-            android:src="@drawable/ic_menu_share"
-            android:visibility="gone" />
-
-        <ImageButton
-            android:id="@+id/market_music"
-            android:layout_width="56dip"
-            android:layout_height="match_parent"
-            android:layout_gravity="center|right"
-            android:background="@drawable/btn_bg"
-            android:src="@drawable/ic_market"
-            android:visibility="gone" />
-
-        <ImageButton
-            android:id="@+id/doSearch"
-            android:layout_width="56dip"
-            android:layout_height="match_parent"
-            android:layout_gravity="center|right"
-            android:background="@drawable/btn_bg"
-            android:src="@drawable/ic_ab_search_holo_dark" />
-
-        <ImageButton
-            android:id="@+id/overFlow"
-            android:layout_width="56dip"
-            android:layout_height="match_parent"
-            android:layout_gravity="center|right"
-            android:background="@drawable/btn_bg"
-            android:src="@drawable/ic_menu_moreoverflow_normal_holo_dark"
-            android:visibility="gone" />
-    </LinearLayout>
-
+<?xml version="1.0" encoding="utf-8"?>\r
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:id="@+id/nowplaying"\r
+    android:layout_width="fill_parent"\r
+    android:layout_height="54.0dip"\r
+    android:background="@drawable/np_bg"\r
+    android:focusable="true"\r
+    android:orientation="vertical" >\r
+\r
+    <ImageView\r
+        android:id="@+id/info_divider"\r
+        android:layout_width="match_parent"\r
+        android:layout_height="1dip"\r
+        android:background="@color/ics"\r
+        android:scaleType="fitXY" />\r
+\r
+    <ProgressBar\r
+        android:id="@+id/progress"\r
+        style="?android:attr/progressBarStyleHorizontal"\r
+        android:layout_width="match_parent"\r
+        android:layout_height="5dip"\r
+        android:progressDrawable="@drawable/progress_horizontal"\r
+        android:visibility="gone" />\r
+\r
+    <LinearLayout\r
+        android:layout_width="fill_parent"\r
+        android:layout_height="fill_parent"\r
+        android:orientation="horizontal" >\r
+\r
+        <ImageView\r
+            android:id="@+id/now_playing_albumart"\r
+            android:layout_width="54.0dip"\r
+            android:layout_height="match_parent"\r
+            android:layout_gravity="left|center"\r
+            android:adjustViewBounds="true"\r
+            android:scaleType="fitXY" />\r
+\r
+        <LinearLayout\r
+            android:layout_width="0.0dip"\r
+            android:layout_height="wrap_content"\r
+            android:layout_gravity="center_vertical"\r
+            android:layout_weight="1.0"\r
+            android:orientation="vertical" >\r
+\r
+            <TextView\r
+                android:id="@+id/now_playing_title"\r
+                android:layout_width="fill_parent"\r
+                android:layout_height="wrap_content"\r
+                android:layout_marginLeft="7.0dip"\r
+                android:ellipsize="end"\r
+                android:singleLine="true"\r
+                android:textAppearance="?android:textAppearanceSmall"\r
+                android:textColor="#dadada"\r
+                android:textSize="10.0sp"\r
+                android:textStyle="bold" />\r
+\r
+            <TextView\r
+                android:id="@+id/now_playing_artist"\r
+                android:layout_width="fill_parent"\r
+                android:layout_height="wrap_content"\r
+                android:layout_marginLeft="7.0dip"\r
+                android:ellipsize="end"\r
+                android:singleLine="true"\r
+                android:textAppearance="?android:textAppearanceSmall"\r
+                android:textColor="#ff999999"\r
+                android:textSize="9.0sp" />\r
+\r
+            <TextView\r
+                android:id="@+id/now_playing_albumname"\r
+                android:layout_width="fill_parent"\r
+                android:layout_height="wrap_content"\r
+                android:layout_marginLeft="7.0dip"\r
+                android:ellipsize="end"\r
+                android:singleLine="true"\r
+                android:textAppearance="?android:textAppearanceSmall"\r
+                android:textColor="#ff999999"\r
+                android:textSize="9.0sp" />\r
+        </LinearLayout>\r
+\r
+        <ImageView\r
+            android:id="@id/icon"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:layout_gravity="center_vertical"\r
+            android:layout_marginLeft="16.0dip" />\r
+\r
+        <ImageButton\r
+            android:id="@+id/media_prev"\r
+            android:layout_width="56dip"\r
+            android:layout_height="match_parent"\r
+            android:layout_gravity="center|right"\r
+            android:background="@drawable/btn_bg"\r
+            android:src="@drawable/ic_appwidget_music_prev"\r
+            android:visibility="gone" />\r
+\r
+        <ImageButton\r
+            android:id="@+id/media_play"\r
+            android:layout_width="56dip"\r
+            android:layout_height="match_parent"\r
+            android:layout_gravity="center|right"\r
+            android:background="@drawable/btn_bg"\r
+            android:src="@drawable/ic_appwidget_music_play"\r
+            android:visibility="gone" />\r
+\r
+        <ImageButton\r
+            android:id="@+id/media_next"\r
+            android:layout_width="56dip"\r
+            android:layout_height="match_parent"\r
+            android:layout_gravity="center|right"\r
+            android:background="@drawable/btn_bg"\r
+            android:src="@drawable/ic_appwidget_music_next"\r
+            android:visibility="gone" />\r
+\r
+        <ImageButton\r
+            android:id="@+id/plus_playlist"\r
+            android:layout_width="56dip"\r
+            android:layout_height="match_parent"\r
+            android:layout_gravity="center|right"\r
+            android:background="@drawable/btn_bg"\r
+            android:src="@drawable/ic_menu_add_playlist" />\r
+\r
+        <ImageButton\r
+            android:id="@+id/share_song"\r
+            android:layout_width="56dip"\r
+            android:layout_height="match_parent"\r
+            android:layout_gravity="center|right"\r
+            android:background="@drawable/btn_bg"\r
+            android:src="@drawable/ic_menu_share"\r
+            android:visibility="gone" />\r
+\r
+        <ImageButton\r
+            android:id="@+id/market_music"\r
+            android:layout_width="56dip"\r
+            android:layout_height="match_parent"\r
+            android:layout_gravity="center|right"\r
+            android:background="@drawable/btn_bg"\r
+            android:src="@drawable/ic_market"\r
+            android:visibility="gone" />\r
+\r
+        <ImageButton\r
+            android:id="@+id/doSearch"\r
+            android:layout_width="56dip"\r
+            android:layout_height="match_parent"\r
+            android:layout_gravity="center|right"\r
+            android:background="@drawable/btn_bg"\r
+            android:src="@drawable/ic_ab_search_holo_dark" />\r
+\r
+        <ImageButton\r
+            android:id="@+id/overFlow"\r
+            android:layout_width="56dip"\r
+            android:layout_height="match_parent"\r
+            android:layout_gravity="center|right"\r
+            android:background="@drawable/btn_bg"\r
+            android:src="@drawable/ic_menu_moreoverflow_normal_holo_dark"\r
+            android:visibility="gone" />\r
+    </LinearLayout>\r
+\r
 </LinearLayout>
\ No newline at end of file
index ce1a2cd..f53bf2a 100644 (file)
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/statusbar"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:orientation="vertical" >
-
-    <LinearLayout
-        xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
-        android:orientation="horizontal" >
-
-        <ImageView
-            android:id="@+id/icon"
-            android:layout_width="64.0dip"
-            android:layout_height="64.0dip"
-            android:layout_weight="0.0"
-            android:gravity="center" />
-
-        <ImageView
-            android:id="@+id/status_icon"
-            android:layout_width="64.0dip"
-            android:layout_height="64.0dip"
-            android:background="@drawable/status_bg"
-            android:scaleType="center"
-            android:visibility="gone" />
-
-        <LinearLayout
-            android:layout_width="0.0dp"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center_vertical"
-            android:layout_weight="1.0"
-            android:orientation="vertical"
-            android:paddingLeft="11.0dip" >
-
-            <TextView
-                android:id="@+id/trackname"
-                style="@android:style/TextAppearance.StatusBar.EventContent.Title"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="left"
-                android:ellipsize="marquee"
-                android:focusable="true"
-                android:singleLine="true" />
-
-            <TextView
-                android:id="@+id/artist"
-                style="@android:style/TextAppearance.StatusBar.EventContent"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="left"
-                android:ellipsize="end"
-                android:scrollHorizontally="true"
-                android:singleLine="true" />
-
-            <TextView
-                android:id="@+id/album"
-                style="@android:style/TextAppearance.StatusBar.EventContent"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="left"
-                android:ellipsize="end"
-                android:scrollHorizontally="true"
-                android:singleLine="true" />
-        </LinearLayout>
-
-        <ImageButton
-            android:id="@+id/status_media_prev"
-            android:layout_width="40dip"
-            android:layout_height="40dip"
-            android:layout_gravity="center|right"
-            android:layout_marginRight="5dip"
-            android:layout_marginTop="2dip"
-            android:layout_weight="0.0"
-            android:background="@drawable/btn_bg"
-            android:src="@drawable/status_prev" />
-
-        <ImageButton
-            android:id="@+id/status_media_play"
-            android:layout_width="40dip"
-            android:layout_height="40dip"
-            android:layout_gravity="center|right"
-            android:layout_marginRight="5dip"
-            android:layout_marginTop="2dip"
-            android:layout_weight="0.0"
-            android:background="@drawable/btn_bg"
-            android:src="@drawable/status_play" />
-
-        <ImageButton
-            android:id="@+id/status_media_next"
-            android:layout_width="40dip"
-            android:layout_height="40dip"
-            android:layout_gravity="center|right"
-            android:layout_marginRight="5dip"
-            android:layout_marginTop="2dip"
-            android:layout_weight="0.0"
-            android:background="@drawable/btn_bg"
-            android:src="@drawable/status_next" />
-
-        <ImageButton
-            android:id="@+id/status_media_collapse"
-            android:layout_width="40dip"
-            android:layout_height="40dip"
-            android:layout_gravity="center|right"
-            android:layout_marginRight="5dip"
-            android:layout_marginTop="2dip"
-            android:layout_weight="0.0"
-            android:background="@drawable/btn_bg"
-            android:src="@drawable/btn_collapse_group_normal_holo_dark" />
-    </LinearLayout>
-
+<?xml version="1.0" encoding="utf-8"?>\r
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:id="@+id/statusbar"\r
+    android:layout_width="fill_parent"\r
+    android:layout_height="fill_parent"\r
+    android:orientation="vertical" >\r
+\r
+    <LinearLayout\r
+        xmlns:android="http://schemas.android.com/apk/res/android"\r
+        android:layout_width="fill_parent"\r
+        android:layout_height="fill_parent"\r
+        android:orientation="horizontal" >\r
+\r
+        <ImageView\r
+            android:id="@+id/icon"\r
+            android:layout_width="64.0dip"\r
+            android:layout_height="64.0dip"\r
+            android:layout_weight="0.0"\r
+            android:gravity="center" />\r
+\r
+        <ImageView\r
+            android:id="@+id/status_icon"\r
+            android:layout_width="64.0dip"\r
+            android:layout_height="64.0dip"\r
+            android:background="@drawable/status_bg"\r
+            android:scaleType="center"\r
+            android:visibility="gone" />\r
+\r
+        <LinearLayout\r
+            android:layout_width="0.0dp"\r
+            android:layout_height="wrap_content"\r
+            android:layout_gravity="center_vertical"\r
+            android:layout_weight="1.0"\r
+            android:orientation="vertical"\r
+            android:paddingLeft="11.0dip" >\r
+\r
+            <TextView\r
+                android:id="@+id/trackname"\r
+                style="@android:style/TextAppearance.StatusBar.EventContent.Title"\r
+                android:layout_width="wrap_content"\r
+                android:layout_height="wrap_content"\r
+                android:layout_gravity="left"\r
+                android:ellipsize="marquee"\r
+                android:focusable="true"\r
+                android:singleLine="true" />\r
+\r
+            <TextView\r
+                android:id="@+id/artist"\r
+                style="@android:style/TextAppearance.StatusBar.EventContent"\r
+                android:layout_width="wrap_content"\r
+                android:layout_height="wrap_content"\r
+                android:layout_gravity="left"\r
+                android:ellipsize="end"\r
+                android:scrollHorizontally="true"\r
+                android:singleLine="true" />\r
+\r
+            <TextView\r
+                android:id="@+id/album"\r
+                style="@android:style/TextAppearance.StatusBar.EventContent"\r
+                android:layout_width="wrap_content"\r
+                android:layout_height="wrap_content"\r
+                android:layout_gravity="left"\r
+                android:ellipsize="end"\r
+                android:scrollHorizontally="true"\r
+                android:singleLine="true" />\r
+        </LinearLayout>\r
+\r
+        <ImageButton\r
+            android:id="@+id/status_media_prev"\r
+            android:layout_width="40dip"\r
+            android:layout_height="40dip"\r
+            android:layout_gravity="center|right"\r
+            android:layout_marginRight="5dip"\r
+            android:layout_marginTop="2dip"\r
+            android:layout_weight="0.0"\r
+            android:background="@drawable/btn_bg"\r
+            android:src="@drawable/status_prev" />\r
+\r
+        <ImageButton\r
+            android:id="@+id/status_media_play"\r
+            android:layout_width="40dip"\r
+            android:layout_height="40dip"\r
+            android:layout_gravity="center|right"\r
+            android:layout_marginRight="5dip"\r
+            android:layout_marginTop="2dip"\r
+            android:layout_weight="0.0"\r
+            android:background="@drawable/btn_bg"\r
+            android:src="@drawable/status_play" />\r
+\r
+        <ImageButton\r
+            android:id="@+id/status_media_next"\r
+            android:layout_width="40dip"\r
+            android:layout_height="40dip"\r
+            android:layout_gravity="center|right"\r
+            android:layout_marginRight="5dip"\r
+            android:layout_marginTop="2dip"\r
+            android:layout_weight="0.0"\r
+            android:background="@drawable/btn_bg"\r
+            android:src="@drawable/status_next" />\r
+\r
+        <ImageButton\r
+            android:id="@+id/status_media_collapse"\r
+            android:layout_width="40dip"\r
+            android:layout_height="40dip"\r
+            android:layout_gravity="center|right"\r
+            android:layout_marginRight="5dip"\r
+            android:layout_marginTop="2dip"\r
+            android:layout_weight="0.0"\r
+            android:background="@drawable/btn_bg"\r
+            android:src="@drawable/btn_collapse_group_normal_holo_dark" />\r
+    </LinearLayout>\r
+\r
 </LinearLayout>
\ No newline at end of file
index 0bfea3d..6b9c959 100644 (file)
@@ -1,93 +1,93 @@
-<?xml version="1.0" encoding="utf-8"?>
-<merge xmlns:android="http://schemas.android.com/apk/res/android" >
-
-    <ImageView
-        android:id="@+id/icon"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentBottom="true"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true" />
-
-    <TextView
-        android:id="@+id/duration"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignBaseline="@id/line1"
-        android:layout_alignParentRight="true"
-        android:paddingLeft="4.0dip"
-        android:paddingRight="11.0dip"
-        android:singleLine="true"
-        android:textColor="#ff999999"
-        android:textSize="12.0sp"
-        android:textStyle="bold" />
-
-    <TextView
-        android:id="@+id/line1"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignWithParentIfMissing="true"
-        android:layout_toLeftOf="@id/duration"
-        android:layout_toRightOf="@id/icon"
-        android:ellipsize="marquee"
-        android:paddingLeft="9.0dip"
-        android:paddingTop="9.0dip"
-        android:shadowColor="#ff000000"
-        android:shadowDx="0"
-        android:shadowDy="0"
-        android:shadowRadius="3"
-        android:singleLine="true"
-        android:textAppearance="?android:textAppearanceSmall"
-        android:textColor="#dadada" />
-
-    <TextView
-        android:id="@+id/line2"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignWithParentIfMissing="true"
-        android:layout_below="@id/line1"
-        android:layout_toLeftOf="@id/duration"
-        android:layout_toRightOf="@id/icon"
-        android:ellipsize="end"
-        android:paddingLeft="9.0dip"
-        android:paddingTop="9.0dip"
-        android:scrollHorizontally="true"
-        android:shadowColor="#ff000000"
-        android:shadowDx="0"
-        android:shadowDy="0"
-        android:shadowRadius="3"
-        android:singleLine="true"
-        android:textAppearance="?android:textAppearanceSmall"
-        android:textColor="#ff999999"
-        android:visibility="visible" />
-
-    <ImageView
-        android:id="@+id/play_indicator"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentRight="true"
-        android:layout_alignParentTop="true"
-        android:layout_below="@id/duration"
-        android:layout_marginRight="42.0dip"
-        android:layout_marginTop="18.0dip" />
-
-    <FrameLayout
-        android:id="@+id/second_column_icon"
-        android:layout_width="wrap_content"
-        android:layout_height="fill_parent"
-        android:layout_alignParentRight="true"
-        android:background="@drawable/btn_bg"
-        android:clickable="true"
-        android:paddingRight="4.0dip" >
-
-        <ImageView
-            android:id="@+id/CM"
-            android:layout_width="wrap_content"
-            android:layout_height="fill_parent"
-            android:layout_gravity="center"
-            android:layout_marginRight="5.0dip"
-            android:scaleType="centerInside"
-            android:src="@drawable/btn_context_menu" />
-    </FrameLayout>
-
+<?xml version="1.0" encoding="utf-8"?>\r
+<merge xmlns:android="http://schemas.android.com/apk/res/android" >\r
+\r
+    <ImageView\r
+        android:id="@+id/icon"\r
+        android:layout_width="wrap_content"\r
+        android:layout_height="wrap_content"\r
+        android:layout_alignParentBottom="true"\r
+        android:layout_alignParentLeft="true"\r
+        android:layout_alignParentTop="true" />\r
+\r
+    <TextView\r
+        android:id="@+id/duration"\r
+        android:layout_width="wrap_content"\r
+        android:layout_height="wrap_content"\r
+        android:layout_alignBaseline="@id/line1"\r
+        android:layout_alignParentRight="true"\r
+        android:paddingLeft="4.0dip"\r
+        android:paddingRight="11.0dip"\r
+        android:singleLine="true"\r
+        android:textColor="#ff999999"\r
+        android:textSize="12.0sp"\r
+        android:textStyle="bold" />\r
+\r
+    <TextView\r
+        android:id="@+id/line1"\r
+        android:layout_width="wrap_content"\r
+        android:layout_height="wrap_content"\r
+        android:layout_alignWithParentIfMissing="true"\r
+        android:layout_toLeftOf="@id/duration"\r
+        android:layout_toRightOf="@id/icon"\r
+        android:ellipsize="marquee"\r
+        android:paddingLeft="9.0dip"\r
+        android:paddingTop="9.0dip"\r
+        android:shadowColor="#ff000000"\r
+        android:shadowDx="0"\r
+        android:shadowDy="0"\r
+        android:shadowRadius="3"\r
+        android:singleLine="true"\r
+        android:textAppearance="?android:textAppearanceSmall"\r
+        android:textColor="#dadada" />\r
+\r
+    <TextView\r
+        android:id="@+id/line2"\r
+        android:layout_width="wrap_content"\r
+        android:layout_height="wrap_content"\r
+        android:layout_alignWithParentIfMissing="true"\r
+        android:layout_below="@id/line1"\r
+        android:layout_toLeftOf="@id/duration"\r
+        android:layout_toRightOf="@id/icon"\r
+        android:ellipsize="end"\r
+        android:paddingLeft="9.0dip"\r
+        android:paddingTop="9.0dip"\r
+        android:scrollHorizontally="true"\r
+        android:shadowColor="#ff000000"\r
+        android:shadowDx="0"\r
+        android:shadowDy="0"\r
+        android:shadowRadius="3"\r
+        android:singleLine="true"\r
+        android:textAppearance="?android:textAppearanceSmall"\r
+        android:textColor="#ff999999"\r
+        android:visibility="visible" />\r
+\r
+    <ImageView\r
+        android:id="@+id/play_indicator"\r
+        android:layout_width="wrap_content"\r
+        android:layout_height="wrap_content"\r
+        android:layout_alignParentRight="true"\r
+        android:layout_alignParentTop="true"\r
+        android:layout_below="@id/duration"\r
+        android:layout_marginRight="42.0dip"\r
+        android:layout_marginTop="18.0dip" />\r
+\r
+    <FrameLayout\r
+        android:id="@+id/second_column_icon"\r
+        android:layout_width="wrap_content"\r
+        android:layout_height="fill_parent"\r
+        android:layout_alignParentRight="true"\r
+        android:background="@drawable/btn_bg"\r
+        android:clickable="true"\r
+        android:paddingRight="4.0dip" >\r
+\r
+        <ImageView\r
+            android:id="@+id/CM"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="fill_parent"\r
+            android:layout_gravity="center"\r
+            android:layout_marginRight="5.0dip"\r
+            android:scaleType="centerInside"\r
+            android:src="@drawable/btn_context_menu" />\r
+    </FrameLayout>\r
+\r
 </merge>
\ No newline at end of file
index 711578a..ec81ee3 100644 (file)
@@ -1,85 +1,85 @@
-<?xml version="1.0" encoding="utf-8"?>
-<merge xmlns:android="http://schemas.android.com/apk/res/android" >
-
-    <ImageView
-        android:id="@+id/icon"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentBottom="true"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true" />
-
-    <TextView
-        android:id="@+id/duration"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignBaseline="@id/line1"
-        android:layout_alignParentRight="true"
-        android:paddingLeft="4.0dip"
-        android:paddingRight="11.0dip"
-        android:singleLine="true"
-        android:textColor="#ff999999"
-        android:textSize="12.0sp"
-        android:textStyle="bold" />
-
-    <TextView
-        android:id="@+id/line1"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignWithParentIfMissing="true"
-        android:layout_toLeftOf="@id/duration"
-        android:layout_toRightOf="@id/icon"
-        android:ellipsize="marquee"
-        android:paddingLeft="9.0dip"
-        android:paddingTop="9.0dip"
-        android:singleLine="true"
-        android:textAppearance="?android:textAppearanceSmall"
-        android:textColor="#ff171717" />
-
-    <TextView
-        android:id="@+id/line2"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignWithParentIfMissing="true"
-        android:layout_below="@id/line1"
-        android:layout_toLeftOf="@id/duration"
-        android:layout_toRightOf="@id/icon"
-        android:ellipsize="end"
-        android:paddingLeft="9.0dip"
-        android:paddingTop="9.0dip"
-        android:scrollHorizontally="true"
-        android:singleLine="true"
-        android:textAppearance="?android:textAppearanceSmall"
-        android:textColor="#801f1f1f"
-        android:visibility="visible" />
-
-    <ImageView
-        android:id="@+id/play_indicator"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentRight="true"
-        android:layout_alignParentTop="true"
-        android:layout_below="@id/duration"
-        android:layout_marginRight="42.0dip"
-        android:layout_marginTop="18.0dip" />
-
-    <FrameLayout
-        android:id="@+id/second_column_icon"
-        android:layout_width="wrap_content"
-        android:layout_height="fill_parent"
-        android:layout_alignParentRight="true"
-        android:background="@drawable/btn_bg"
-        android:clickable="true"
-        android:paddingRight="4.0dip" >
-
-        <ImageView
-            android:id="@+id/CM"
-            android:layout_width="wrap_content"
-            android:layout_height="fill_parent"
-            android:layout_gravity="center"
-            android:layout_marginRight="5.0dip"
-            android:scaleType="centerInside"
-            android:src="@drawable/btn_context_menu_child" />
-    </FrameLayout>
-
+<?xml version="1.0" encoding="utf-8"?>\r
+<merge xmlns:android="http://schemas.android.com/apk/res/android" >\r
+\r
+    <ImageView\r
+        android:id="@+id/icon"\r
+        android:layout_width="wrap_content"\r
+        android:layout_height="wrap_content"\r
+        android:layout_alignParentBottom="true"\r
+        android:layout_alignParentLeft="true"\r
+        android:layout_alignParentTop="true" />\r
+\r
+    <TextView\r
+        android:id="@+id/duration"\r
+        android:layout_width="wrap_content"\r
+        android:layout_height="wrap_content"\r
+        android:layout_alignBaseline="@id/line1"\r
+        android:layout_alignParentRight="true"\r
+        android:paddingLeft="4.0dip"\r
+        android:paddingRight="11.0dip"\r
+        android:singleLine="true"\r
+        android:textColor="#ff999999"\r
+        android:textSize="12.0sp"\r
+        android:textStyle="bold" />\r
+\r
+    <TextView\r
+        android:id="@+id/line1"\r
+        android:layout_width="wrap_content"\r
+        android:layout_height="wrap_content"\r
+        android:layout_alignWithParentIfMissing="true"\r
+        android:layout_toLeftOf="@id/duration"\r
+        android:layout_toRightOf="@id/icon"\r
+        android:ellipsize="marquee"\r
+        android:paddingLeft="9.0dip"\r
+        android:paddingTop="9.0dip"\r
+        android:singleLine="true"\r
+        android:textAppearance="?android:textAppearanceSmall"\r
+        android:textColor="#ff171717" />\r
+\r
+    <TextView\r
+        android:id="@+id/line2"\r
+        android:layout_width="wrap_content"\r
+        android:layout_height="wrap_content"\r
+        android:layout_alignWithParentIfMissing="true"\r
+        android:layout_below="@id/line1"\r
+        android:layout_toLeftOf="@id/duration"\r
+        android:layout_toRightOf="@id/icon"\r
+        android:ellipsize="end"\r
+        android:paddingLeft="9.0dip"\r
+        android:paddingTop="9.0dip"\r
+        android:scrollHorizontally="true"\r
+        android:singleLine="true"\r
+        android:textAppearance="?android:textAppearanceSmall"\r
+        android:textColor="#801f1f1f"\r
+        android:visibility="visible" />\r
+\r
+    <ImageView\r
+        android:id="@+id/play_indicator"\r
+        android:layout_width="wrap_content"\r
+        android:layout_height="wrap_content"\r
+        android:layout_alignParentRight="true"\r
+        android:layout_alignParentTop="true"\r
+        android:layout_below="@id/duration"\r
+        android:layout_marginRight="42.0dip"\r
+        android:layout_marginTop="18.0dip" />\r
+\r
+    <FrameLayout\r
+        android:id="@+id/second_column_icon"\r
+        android:layout_width="wrap_content"\r
+        android:layout_height="fill_parent"\r
+        android:layout_alignParentRight="true"\r
+        android:background="@drawable/btn_bg"\r
+        android:clickable="true"\r
+        android:paddingRight="4.0dip" >\r
+\r
+        <ImageView\r
+            android:id="@+id/CM"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="fill_parent"\r
+            android:layout_gravity="center"\r
+            android:layout_marginRight="5.0dip"\r
+            android:scaleType="centerInside"\r
+            android:src="@drawable/btn_context_menu_child" />\r
+    </FrameLayout>\r
+\r
 </merge>
\ No newline at end of file
index 39d46d4..5aaa60d 100644 (file)
@@ -1,15 +1,15 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android" >
-
-    <item
-        android:id="@+id/delete"
-        android:icon="@drawable/ic_menu_delete"
-        android:showAsAction="always|withText"
-        android:title="@string/delete_item"/>
-    <item
-        android:id="@+id/add"
-        android:icon="@drawable/ic_menu_add"
-        android:showAsAction="always|withText"
-        android:title="@string/add_to_playlist"/>
-
+<?xml version="1.0" encoding="utf-8"?>\r
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >\r
+\r
+    <item\r
+        android:id="@+id/delete"\r
+        android:icon="@drawable/ic_menu_delete"\r
+        android:showAsAction="always|withText"\r
+        android:title="@string/delete_item"/>\r
+    <item\r
+        android:id="@+id/add"\r
+        android:icon="@drawable/ic_menu_add"\r
+        android:showAsAction="always|withText"\r
+        android:title="@string/add_to_playlist"/>\r
+\r
 </menu>
\ No newline at end of file
index 883f7a1..65c491c 100644 (file)
@@ -1,18 +1,18 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     Copyright (C) 2009 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.
--->
-
-<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
-    android:initialLayout="@layout/album_appwidget3x1"
-    android:minHeight="40dp"
-    android:minWidth="180dp"
-    android:updatePeriodMillis="0" >
-
+<?xml version="1.0" encoding="utf-8"?>\r
+<!--\r
+     Copyright (C) 2009 The Android Open Source Project Licensed under the \r
+       Apache License, Version 2.0 (the "License"); you may not use this file except \r
+       in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 \r
+       Unless required by applicable law or agreed to in writing, software distributed \r
+       under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES \r
+       OR CONDITIONS OF ANY KIND, either express or implied. See the License for \r
+       the specific language governing permissions and limitations under the License.\r
+-->\r
+\r
+<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:initialLayout="@layout/album_appwidget3x1"\r
+    android:minHeight="40dp"\r
+    android:minWidth="180dp"\r
+    android:updatePeriodMillis="0" >\r
+\r
 </appwidget-provider>
\ No newline at end of file
index 4653c8a..50094a3 100644 (file)
@@ -1,23 +1,23 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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.
--->
-
-<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
-    android:minWidth="250dp"
-    android:minHeight="110dp"
-    android:updatePeriodMillis="0"
-    android:initialLayout="@layout/album_appwidget4x2"
-    >
-</appwidget-provider>
+<?xml version="1.0" encoding="utf-8"?>\r
+<!-- Copyright (C) 2009 The Android Open Source Project\r
+\r
+     Licensed under the Apache License, Version 2.0 (the "License");\r
+     you may not use this file except in compliance with the License.\r
+     You may obtain a copy of the License at\r
+  \r
+          http://www.apache.org/licenses/LICENSE-2.0\r
+  \r
+     Unless required by applicable law or agreed to in writing, software\r
+     distributed under the License is distributed on an "AS IS" BASIS,\r
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+     See the License for the specific language governing permissions and\r
+     limitations under the License.\r
+-->\r
+\r
+<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:minWidth="250dp"\r
+    android:minHeight="110dp"\r
+    android:updatePeriodMillis="0"\r
+    android:initialLayout="@layout/album_appwidget4x2"\r
+    >\r
+</appwidget-provider>\r
index 751dca7..2045585 100644 (file)
@@ -252,14 +252,10 @@ public class AlbumBrowserActivity extends ListActivity implements
                        mButtonBarSong = (TextView) findViewById(R.id.songtab);
                        mButtonBarPlaylist = (TextView) findViewById(R.id.playlisttab);
                        mButtonBarNP = (TextView) findViewById(R.id.nowplayingtab);
-                       mGroup = (RelativeLayout) findViewById(R.id.group_item);
-                       mChild = (RelativeLayout) findViewById(R.id.child_item);
                        ArtistAlbumBrowserActivity
                                        .loadThemeResource(themeResources, themePackage,
                                                        "tab_album", mAlbumTab, THEME_ITEM_BACKGROUND);
                        ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
-                                       themePackage, "child_bg", mChild, THEME_ITEM_BACKGROUND);
-                       ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
                                        themePackage, "buttonbar", mButtonBar,
                                        THEME_ITEM_BACKGROUND);
                        ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
@@ -1175,6 +1171,9 @@ public class AlbumBrowserActivity extends ListActivity implements
                                if (line2 != 0) {
                                        vh.line2.setTextColor(themeResources.getColor(line2));
                                }
+                               ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
+                                               themePackage, "bt_context_menu", vh.mCM,
+                                               THEME_ITEM_FOREGROUND);
                        }
                        return v;
                }
@@ -1182,6 +1181,23 @@ public class AlbumBrowserActivity extends ListActivity implements
                @Override
                public void bindView(View view, Context context, Cursor cursor) {
 
+                       // ADW: Load the specified theme
+                       String themePackage = MusicUtils.getThemePackageName(context,
+                                       MusicSettingsActivity.THEME_DEFAULT);
+                       PackageManager pm = context.getPackageManager();
+                       Resources themeResources = null;
+                       if (!themePackage.equals(MusicSettingsActivity.THEME_DEFAULT)) {
+                               try {
+                                       themeResources = pm
+                                                       .getResourcesForApplication(themePackage);
+                               } catch (NameNotFoundException e) {
+                                       // ADW The saved theme was uninstalled so we save the
+                                       // default one
+                                       MusicUtils.setThemePackageName(context,
+                                                       MusicSettingsActivity.THEME_DEFAULT);
+                               }
+                       }
+
                        ViewHolder vh = (ViewHolder) view.getTag();
 
                        String name = cursor.getString(mAlbumIdx);
@@ -1217,6 +1233,14 @@ public class AlbumBrowserActivity extends ListActivity implements
                                iv.setBackgroundResource(R.anim.peak_meter);
                                AnimationDrawable frameAnimation = (AnimationDrawable) iv
                                                .getBackground();
+                               if (themeResources != null) {
+                                       int peak = themeResources.getIdentifier("peak_meter",
+                                                       "anim", themePackage);
+                                       if (peak != 0) {
+                                               iv.setBackgroundDrawable(themeResources
+                                                               .getDrawable(peak));
+                                       }
+                               }
                                // Start the animation (looped playback by default).
                                frameAnimation.start();
                                iv.setVisibility(View.VISIBLE);
@@ -1314,14 +1338,14 @@ public class AlbumBrowserActivity extends ListActivity implements
                                mPlay.setImageResource(R.drawable.ic_media_pause);
                                if (themeResources != null) {
                                        ArtistAlbumBrowserActivity.loadThemeResource(
-                                                       themeResources, themePackage, "np_pause", mPlay,
+                                                       themeResources, themePackage, "snp_pause", mPlay,
                                                        THEME_ITEM_FOREGROUND);
                                }
                        } else {
                                mPlay.setImageResource(R.drawable.ic_appwidget_music_play);
                                if (themeResources != null) {
                                        ArtistAlbumBrowserActivity.loadThemeResource(
-                                                       themeResources, themePackage, "np_play", mPlay,
+                                                       themeResources, themePackage, "snp_play", mPlay,
                                                        THEME_ITEM_FOREGROUND);
                                }
                        }
index 80ec0c2..63a414b 100644 (file)
@@ -239,12 +239,8 @@ public class ArtistAlbumBrowserActivity extends ExpandableListActivity
                        mButtonBarSong = (TextView) findViewById(R.id.songtab);
                        mButtonBarPlaylist = (TextView) findViewById(R.id.playlisttab);
                        mButtonBarNP = (TextView) findViewById(R.id.nowplayingtab);
-                       mGroup = (RelativeLayout) findViewById(R.id.group_item);
-                       mChild = (RelativeLayout) findViewById(R.id.child_item);
                        loadThemeResource(themeResources, themePackage, "tab_artist",
                                        mArtistTab, THEME_ITEM_BACKGROUND);
-                       loadThemeResource(themeResources, themePackage, "child_bg", mChild,
-                                       THEME_ITEM_BACKGROUND);
                        loadThemeResource(themeResources, themePackage, "buttonbar",
                                        mButtonBar, THEME_ITEM_BACKGROUND);
                        loadThemeResource(themeResources, themePackage, "tab_bg_artist",
@@ -1074,6 +1070,8 @@ public class ArtistAlbumBrowserActivity extends ExpandableListActivity
                        ImageView play_indicator;
                        ImageView icon;
                        ImageView mCM;
+                       RelativeLayout mGroup;
+                       RelativeLayout mChild;
                        FrameLayout mContextMenu;
                }
 
@@ -1169,6 +1167,7 @@ public class ArtistAlbumBrowserActivity extends ExpandableListActivity
                        vh.mContextMenu = (FrameLayout) v
                                        .findViewById(R.id.second_column_icon);
                        vh.mContextMenu.setOnClickListener(mCML);
+                       vh.mGroup = (RelativeLayout) v.findViewById(R.id.group_item);
 
                        // ADW: Load the specified theme
                        String themePackage = MusicUtils.getThemePackageName(context,
@@ -1199,6 +1198,15 @@ public class ArtistAlbumBrowserActivity extends ExpandableListActivity
                                if (line2 != 0) {
                                        vh.line2.setTextColor(themeResources.getColor(line2));
                                }
+                               int mGroupItem = themeResources.getIdentifier("group_bg",
+                                               "drawable", themePackage);
+                               if (mGroupItem != 0) {
+                                       vh.mGroup.setBackgroundDrawable(themeResources
+                                                       .getDrawable(mGroupItem));
+                               }
+                               loadThemeResource(themeResources, themePackage,
+                                               "bt_context_menu", vh.mCM, THEME_ITEM_FOREGROUND);
+
                        }
                        return v;
                }
@@ -1219,6 +1227,7 @@ public class ArtistAlbumBrowserActivity extends ExpandableListActivity
                        vh.mContextMenu = (FrameLayout) v
                                        .findViewById(R.id.second_column_icon);
                        vh.mContextMenu.setOnClickListener(mCML);
+                       vh.mChild = (RelativeLayout) v.findViewById(R.id.child_item);
                        // ADW: Load the specified theme
                        String themePackage = MusicUtils.getThemePackageName(context,
                                        MusicSettingsActivity.THEME_DEFAULT);
@@ -1248,6 +1257,14 @@ public class ArtistAlbumBrowserActivity extends ExpandableListActivity
                                if (line2 != 0) {
                                        vh.line2.setTextColor(themeResources.getColor(line2));
                                }
+                               int mChildItem = themeResources.getIdentifier("child_bg",
+                                               "drawable", themePackage);
+                               if (mChildItem != 0) {
+                                       vh.mChild.setBackgroundDrawable(themeResources
+                                                       .getDrawable(mChildItem));
+                               }
+                               loadThemeResource(themeResources, themePackage,
+                                               "bt_context_menu", vh.mCM, THEME_ITEM_FOREGROUND);
                        }
                        return v;
                }
@@ -1255,6 +1272,22 @@ public class ArtistAlbumBrowserActivity extends ExpandableListActivity
                @Override
                public void bindGroupView(View view, Context context, Cursor cursor,
                                boolean isexpanded) {
+                       // ADW: Load the specified theme
+                       String themePackage = MusicUtils.getThemePackageName(context,
+                                       MusicSettingsActivity.THEME_DEFAULT);
+                       PackageManager pm = context.getPackageManager();
+                       Resources themeResources = null;
+                       if (!themePackage.equals(MusicSettingsActivity.THEME_DEFAULT)) {
+                               try {
+                                       themeResources = pm
+                                                       .getResourcesForApplication(themePackage);
+                               } catch (NameNotFoundException e) {
+                                       // ADW The saved theme was uninstalled so we save the
+                                       // default one
+                                       MusicUtils.setThemePackageName(context,
+                                                       MusicSettingsActivity.THEME_DEFAULT);
+                               }
+                       }
 
                        ViewHolder vh = (ViewHolder) view.getTag();
 
@@ -1282,6 +1315,15 @@ public class ArtistAlbumBrowserActivity extends ExpandableListActivity
                                iv.setBackgroundResource(R.anim.peak_meter);
                                AnimationDrawable frameAnimation = (AnimationDrawable) iv
                                                .getBackground();
+                               if (themeResources != null) {
+                                       int peak = themeResources.getIdentifier("peak_meter",
+                                                       "anim", themePackage);
+                                       if (peak != 0) {
+                                               iv.setBackgroundDrawable(themeResources
+                                                               .getDrawable(peak));
+                                               frameAnimation.start();
+                                       }
+                               }
                                // Start the animation (looped playback by default).
                                frameAnimation.start();
                                iv.setVisibility(View.VISIBLE);
@@ -1294,6 +1336,22 @@ public class ArtistAlbumBrowserActivity extends ExpandableListActivity
                @Override
                public void bindChildView(View view, Context context, Cursor cursor,
                                boolean islast) {
+                       // ADW: Load the specified theme
+                       String themePackage = MusicUtils.getThemePackageName(context,
+                                       MusicSettingsActivity.THEME_DEFAULT);
+                       PackageManager pm = context.getPackageManager();
+                       Resources themeResources = null;
+                       if (!themePackage.equals(MusicSettingsActivity.THEME_DEFAULT)) {
+                               try {
+                                       themeResources = pm
+                                                       .getResourcesForApplication(themePackage);
+                               } catch (NameNotFoundException e) {
+                                       // ADW The saved theme was uninstalled so we save the
+                                       // default one
+                                       MusicUtils.setThemePackageName(context,
+                                                       MusicSettingsActivity.THEME_DEFAULT);
+                               }
+                       }
 
                        ViewHolder vh = (ViewHolder) view.getTag();
 
@@ -1363,10 +1421,16 @@ public class ArtistAlbumBrowserActivity extends ExpandableListActivity
                                iv.setBackgroundResource(R.anim.peak_meter);
                                AnimationDrawable frameAnimation = (AnimationDrawable) iv
                                                .getBackground();
-
+                               if (themeResources != null) {
+                                       int peak = themeResources.getIdentifier("peak_meter",
+                                                       "anim", themePackage);
+                                       if (peak != 0) {
+                                               iv.setBackgroundDrawable(themeResources
+                                                               .getDrawable(peak));
+                                       }
+                               }
                                // Start the animation (looped playback by default).
                                frameAnimation.start();
-
                                iv.setVisibility(View.VISIBLE);
                        } else {
                                iv.setVisibility(View.GONE);
@@ -1523,12 +1587,13 @@ public class ArtistAlbumBrowserActivity extends ExpandableListActivity
                try {
                        if (mService != null && mService.isPlaying()) {
                                mPlay.setImageResource(R.drawable.ic_media_pause);
-                               ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
-                                               themePackage, "np_pause", mPlay, THEME_ITEM_FOREGROUND);
+                               ArtistAlbumBrowserActivity
+                                               .loadThemeResource(themeResources, themePackage,
+                                                               "snp_pause", mPlay, THEME_ITEM_FOREGROUND);
                        } else {
                                mPlay.setImageResource(R.drawable.ic_appwidget_music_play);
                                ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
-                                               themePackage, "np_play", mPlay, THEME_ITEM_FOREGROUND);
+                                               themePackage, "snp_play", mPlay, THEME_ITEM_FOREGROUND);
                        }
                } catch (RemoteException ex) {
                }
index f816ab3..d92d369 100644 (file)
@@ -1,60 +1,60 @@
-/* //device/samples/SampleCode/src/com/android/samples/app/RemoteServiceInterface.java
-**
-** Copyright 2007, 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.
-*/
-
-package com.android.music;
-
-import android.graphics.Bitmap;
-
-interface IMediaPlaybackService
-{
-    void openFile(String path);
-    void open(in long [] list, int position);
-    int getQueuePosition();
-    boolean isPlaying();
-    void stop();
-    void pause();
-    void play();
-    void prev();
-    void next();
-    void cycleRepeat();
-    void toggleShuffle();
-    long duration();
-    long position();
-    long seek(long pos);
-    String getTrackName();
-    String getAlbumName();
-    long getAlbumId();
-    String getArtistName();
-    long getArtistId();
-    String getAlbumartistName();
-    long getAlbumartistId();
-    void enqueue(in long [] list, int action);
-    long [] getQueue();
-    void moveQueueItem(int from, int to);
-    void setQueuePosition(int index);
-    String getPath();
-    long getAudioId();
-    void setShuffleMode(int shufflemode);
-    int getShuffleMode();
-    int removeTracks(int first, int last);
-    int removeTrack(long id);
-    void setRepeatMode(int repeatmode);
-    int getRepeatMode();
-    int getMediaMountedCount();
-    int getAudioSessionId();
-}
-
+/* //device/samples/SampleCode/src/com/android/samples/app/RemoteServiceInterface.java\r
+**\r
+** Copyright 2007, The Android Open Source Project\r
+**\r
+** Licensed under the Apache License, Version 2.0 (the "License"); \r
+** you may not use this file except in compliance with the License. \r
+** You may obtain a copy of the License at \r
+**\r
+**     http://www.apache.org/licenses/LICENSE-2.0 \r
+**\r
+** Unless required by applicable law or agreed to in writing, software \r
+** distributed under the License is distributed on an "AS IS" BASIS, \r
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \r
+** See the License for the specific language governing permissions and \r
+** limitations under the License.\r
+*/\r
+\r
+package com.android.music;\r
+\r
+import android.graphics.Bitmap;\r
+\r
+interface IMediaPlaybackService\r
+{\r
+    void openFile(String path);\r
+    void open(in long [] list, int position);\r
+    int getQueuePosition();\r
+    boolean isPlaying();\r
+    void stop();\r
+    void pause();\r
+    void play();\r
+    void prev();\r
+    void next();\r
+    void cycleRepeat();\r
+    void toggleShuffle();\r
+    long duration();\r
+    long position();\r
+    long seek(long pos);\r
+    String getTrackName();\r
+    String getAlbumName();\r
+    long getAlbumId();\r
+    String getArtistName();\r
+    long getArtistId();\r
+    String getAlbumartistName();\r
+    long getAlbumartistId();\r
+    void enqueue(in long [] list, int action);\r
+    long [] getQueue();\r
+    void moveQueueItem(int from, int to);\r
+    void setQueuePosition(int index);\r
+    String getPath();\r
+    long getAudioId();\r
+    void setShuffleMode(int shufflemode);\r
+    int getShuffleMode();\r
+    int removeTracks(int first, int last);\r
+    int removeTrack(long id);\r
+    void setRepeatMode(int repeatmode);\r
+    int getRepeatMode();\r
+    int getMediaMountedCount();\r
+    int getAudioSessionId();\r
+}\r
+\r
index 977348b..9c5b113 100644 (file)
-/*
- * Copyright (C) 2009 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.
- */
-
-package com.android.music;
-
-import android.app.PendingIntent;
-import android.appwidget.AppWidgetManager;
-import android.appwidget.AppWidgetProvider;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
-import android.view.View;
-import android.widget.RemoteViews;
-
-/**
- * Simple widget to show currently playing album art along with play/pause and
- * next track buttons.
- */
-public class MediaAppWidgetProvider1x1 extends AppWidgetProvider {
-       static final String TAG = "MusicAppWidgetProvider1x1";
-
-       public static final String CMDAPPWIDGETUPDATE = "appwidgetupdate1x1";
-
-       private static MediaAppWidgetProvider1x1 sInstance;
-
-       static synchronized MediaAppWidgetProvider1x1 getInstance() {
-               if (sInstance == null) {
-                       sInstance = new MediaAppWidgetProvider1x1();
-               }
-               return sInstance;
-       }
-
-       @Override
-       public void onUpdate(Context context, AppWidgetManager appWidgetManager,
-                       int[] appWidgetIds) {
-               defaultAppWidget(context, appWidgetIds);
-
-               // Send broadcast intent to any running MediaPlaybackService so it can
-               // wrap around with an immediate update.
-               Intent updateIntent = new Intent(MediaPlaybackService.SERVICECMD);
-               updateIntent.putExtra(MediaPlaybackService.CMDNAME,
-                               MediaAppWidgetProvider1x1.CMDAPPWIDGETUPDATE);
-               updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS,
-                               appWidgetIds);
-               updateIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
-               context.sendBroadcast(updateIntent);
-       }
-
-       /**
-        * Initialize given widgets to default state, where we launch Music on
-        * default click and hide actions if service not running.
-        */
-       private void defaultAppWidget(Context context, int[] appWidgetIds) {
-               final RemoteViews views = new RemoteViews(context.getPackageName(),
-                               R.layout.album_appwidget1x1);
-
-               views.setImageViewResource(R.id.albumart, View.GONE);
-
-               linkButtons(context, views, false /* not playing */);
-               pushUpdate(context, appWidgetIds, views);
-       }
-
-       private void pushUpdate(Context context, int[] appWidgetIds,
-                       RemoteViews views) {
-               // Update specific list of appWidgetIds if given, otherwise default to
-               // all
-               final AppWidgetManager gm = AppWidgetManager.getInstance(context);
-               if (appWidgetIds != null) {
-                       gm.updateAppWidget(appWidgetIds, views);
-               } else {
-                       gm.updateAppWidget(new ComponentName(context, this.getClass()),
-                                       views);
-               }
-       }
-
-       /**
-        * Check against {@link AppWidgetManager} if there are any instances of this
-        * widget.
-        */
-       private boolean hasInstances(Context context) {
-               AppWidgetManager appWidgetManager = AppWidgetManager
-                               .getInstance(context);
-               int[] appWidgetIds = appWidgetManager
-                               .getAppWidgetIds(new ComponentName(context, this.getClass()));
-               return (appWidgetIds.length > 0);
-       }
-
-       /**
-        * Handle a change notification coming over from
-        * {@link MediaPlaybackService}
-        */
-       void notifyChange(MediaPlaybackService service, String what) {
-               if (hasInstances(service)) {
-                       if (MediaPlaybackService.META_CHANGED.equals(what)
-                                       || MediaPlaybackService.PLAYSTATE_CHANGED.equals(what)
-                                       || MediaPlaybackService.REPEATMODE_CHANGED.equals(what)
-                                       || MediaPlaybackService.SHUFFLEMODE_CHANGED.equals(what)) {
-                               performUpdate(service, null);
-                       }
-               }
-       }
-
-       /**
-        * Update all active widget instances by pushing changes
-        */
-       void performUpdate(MediaPlaybackService service, int[] appWidgetIds) {
-               final RemoteViews views = new RemoteViews(service.getPackageName(),
-                               R.layout.album_appwidget1x1);
-
-               CharSequence titleName = service.getTrackName();
-               CharSequence artistName = service.getArtistName();
-               long albumId = service.getAlbumId();
-               long songId = service.getAudioId();
-               {
-                       // No error, so show normal titles and artwork
-                       views.setTextViewText(R.id.title, titleName);
-                       views.setTextViewText(R.id.artist, artistName);
-                       views.setViewVisibility(R.id.albumart, View.VISIBLE);
-                       // Set album art
-                       Uri uri = MusicUtils.getArtworkUri(service, songId, albumId);
-                       if (uri != null) {
-                               views.setImageViewUri(R.id.albumart, uri);
-                       } else {
-                               views.setImageViewResource(R.id.albumart,
-                                               R.drawable.albumart_mp_unknown);
-                       }
-               }
-               // Set correct drawable for pause state
-               final boolean playing = service.isPlaying();
-               if (playing) {
-                       views.setImageViewResource(R.id.play_pause,
-                                       R.drawable.appwidget_pause_normal);
-               } else {
-                       views.setImageViewResource(R.id.play_pause,
-                                       R.drawable.appwidget_play_normal);
-               }
-
-               // Link actions buttons to intents
-               linkButtons(service, views, playing);
-
-               pushUpdate(service, appWidgetIds, views);
-       }
-
-       /**
-        * Link up various button actions using {@link PendingIntents}.
-        * 
-        * @param playerActive
-        *            True if player is active in background, which means widget
-        *            click will launch {@link MediaPlaybackActivity}, otherwise we
-        *            launch {@link MusicBrowserActivity}.
-        */
-       private void linkButtons(Context context, RemoteViews views,
-                       boolean playerActive) {
-               // Connect up various buttons and touch events
-               Intent intent;
-               PendingIntent pendingIntent;
-
-               final ComponentName serviceName = new ComponentName(context,
-                               MediaPlaybackService.class);
-
-               intent = new Intent(MediaPlaybackService.TOGGLEPAUSE_ACTION);
-               intent.setComponent(serviceName);
-               pendingIntent = PendingIntent.getService(context,
-                               0 /* no requestCode */, intent, 0 /* no flags */);
-               views.setOnClickPendingIntent(R.id.albumart, pendingIntent);
-
-       }
-}
+/*\r
+ * Copyright (C) 2009 The Android Open Source Project\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package com.android.music;\r
+\r
+import android.app.PendingIntent;\r
+import android.appwidget.AppWidgetManager;\r
+import android.appwidget.AppWidgetProvider;\r
+import android.content.ComponentName;\r
+import android.content.Context;\r
+import android.content.Intent;\r
+import android.net.Uri;\r
+import android.view.View;\r
+import android.widget.RemoteViews;\r
+\r
+/**\r
+ * Simple widget to show currently playing album art along with play/pause and\r
+ * next track buttons.\r
+ */\r
+public class MediaAppWidgetProvider1x1 extends AppWidgetProvider {\r
+       static final String TAG = "MusicAppWidgetProvider1x1";\r
+\r
+       public static final String CMDAPPWIDGETUPDATE = "appwidgetupdate1x1";\r
+\r
+       private static MediaAppWidgetProvider1x1 sInstance;\r
+\r
+       static synchronized MediaAppWidgetProvider1x1 getInstance() {\r
+               if (sInstance == null) {\r
+                       sInstance = new MediaAppWidgetProvider1x1();\r
+               }\r
+               return sInstance;\r
+       }\r
+\r
+       @Override\r
+       public void onUpdate(Context context, AppWidgetManager appWidgetManager,\r
+                       int[] appWidgetIds) {\r
+               defaultAppWidget(context, appWidgetIds);\r
+\r
+               // Send broadcast intent to any running MediaPlaybackService so it can\r
+               // wrap around with an immediate update.\r
+               Intent updateIntent = new Intent(MediaPlaybackService.SERVICECMD);\r
+               updateIntent.putExtra(MediaPlaybackService.CMDNAME,\r
+                               MediaAppWidgetProvider1x1.CMDAPPWIDGETUPDATE);\r
+               updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS,\r
+                               appWidgetIds);\r
+               updateIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);\r
+               context.sendBroadcast(updateIntent);\r
+       }\r
+\r
+       /**\r
+        * Initialize given widgets to default state, where we launch Music on\r
+        * default click and hide actions if service not running.\r
+        */\r
+       private void defaultAppWidget(Context context, int[] appWidgetIds) {\r
+               final RemoteViews views = new RemoteViews(context.getPackageName(),\r
+                               R.layout.album_appwidget1x1);\r
+\r
+               views.setImageViewResource(R.id.albumart, View.GONE);\r
+\r
+               linkButtons(context, views, false /* not playing */);\r
+               pushUpdate(context, appWidgetIds, views);\r
+       }\r
+\r
+       private void pushUpdate(Context context, int[] appWidgetIds,\r
+                       RemoteViews views) {\r
+               // Update specific list of appWidgetIds if given, otherwise default to\r
+               // all\r
+               final AppWidgetManager gm = AppWidgetManager.getInstance(context);\r
+               if (appWidgetIds != null) {\r
+                       gm.updateAppWidget(appWidgetIds, views);\r
+               } else {\r
+                       gm.updateAppWidget(new ComponentName(context, this.getClass()),\r
+                                       views);\r
+               }\r
+       }\r
+\r
+       /**\r
+        * Check against {@link AppWidgetManager} if there are any instances of this\r
+        * widget.\r
+        */\r
+       private boolean hasInstances(Context context) {\r
+               AppWidgetManager appWidgetManager = AppWidgetManager\r
+                               .getInstance(context);\r
+               int[] appWidgetIds = appWidgetManager\r
+                               .getAppWidgetIds(new ComponentName(context, this.getClass()));\r
+               return (appWidgetIds.length > 0);\r
+       }\r
+\r
+       /**\r
+        * Handle a change notification coming over from\r
+        * {@link MediaPlaybackService}\r
+        */\r
+       void notifyChange(MediaPlaybackService service, String what) {\r
+               if (hasInstances(service)) {\r
+                       if (MediaPlaybackService.META_CHANGED.equals(what)\r
+                                       || MediaPlaybackService.PLAYSTATE_CHANGED.equals(what)\r
+                                       || MediaPlaybackService.REPEATMODE_CHANGED.equals(what)\r
+                                       || MediaPlaybackService.SHUFFLEMODE_CHANGED.equals(what)) {\r
+                               performUpdate(service, null);\r
+                       }\r
+               }\r
+       }\r
+\r
+       /**\r
+        * Update all active widget instances by pushing changes\r
+        */\r
+       void performUpdate(MediaPlaybackService service, int[] appWidgetIds) {\r
+               final RemoteViews views = new RemoteViews(service.getPackageName(),\r
+                               R.layout.album_appwidget1x1);\r
+\r
+               CharSequence titleName = service.getTrackName();\r
+               CharSequence artistName = service.getArtistName();\r
+               long albumId = service.getAlbumId();\r
+               long songId = service.getAudioId();\r
+               {\r
+                       // No error, so show normal titles and artwork\r
+                       views.setTextViewText(R.id.title, titleName);\r
+                       views.setTextViewText(R.id.artist, artistName);\r
+                       views.setViewVisibility(R.id.albumart, View.VISIBLE);\r
+                       // Set album art\r
+                       Uri uri = MusicUtils.getArtworkUri(service, songId, albumId);\r
+                       if (uri != null) {\r
+                               views.setImageViewUri(R.id.albumart, uri);\r
+                       } else {\r
+                               views.setImageViewResource(R.id.albumart,\r
+                                               R.drawable.albumart_mp_unknown);\r
+                       }\r
+               }\r
+               // Set correct drawable for pause state\r
+               final boolean playing = service.isPlaying();\r
+               if (playing) {\r
+                       views.setImageViewResource(R.id.play_pause,\r
+                                       R.drawable.appwidget_pause_normal);\r
+               } else {\r
+                       views.setImageViewResource(R.id.play_pause,\r
+                                       R.drawable.appwidget_play_normal);\r
+               }\r
+\r
+               // Link actions buttons to intents\r
+               linkButtons(service, views, playing);\r
+\r
+               pushUpdate(service, appWidgetIds, views);\r
+       }\r
+\r
+       /**\r
+        * Link up various button actions using {@link PendingIntents}.\r
+        * \r
+        * @param playerActive\r
+        *            True if player is active in background, which means widget\r
+        *            click will launch {@link MediaPlaybackActivity}, otherwise we\r
+        *            launch {@link MusicBrowserActivity}.\r
+        */\r
+       private void linkButtons(Context context, RemoteViews views,\r
+                       boolean playerActive) {\r
+               // Connect up various buttons and touch events\r
+               Intent intent;\r
+               PendingIntent pendingIntent;\r
+\r
+               final ComponentName serviceName = new ComponentName(context,\r
+                               MediaPlaybackService.class);\r
+\r
+               intent = new Intent(MediaPlaybackService.TOGGLEPAUSE_ACTION);\r
+               intent.setComponent(serviceName);\r
+               pendingIntent = PendingIntent.getService(context,\r
+                               0 /* no requestCode */, intent, 0 /* no flags */);\r
+               views.setOnClickPendingIntent(R.id.albumart, pendingIntent);\r
+\r
+       }\r
+}\r
index d00549b..699f0a1 100644 (file)
-/*
- * Copyright (C) 2009 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.
- */
-
-package com.android.music;
-
-import android.app.PendingIntent;
-import android.appwidget.AppWidgetManager;
-import android.appwidget.AppWidgetProvider;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.res.Resources;
-import android.net.Uri;
-import android.os.Environment;
-import android.view.View;
-import android.widget.RemoteViews;
-
-/**
- * Simple widget to show currently playing album art along with play/pause and
- * next track buttons.
- */
-public class MediaAppWidgetProvider3x1 extends AppWidgetProvider {
-       static final String TAG = "MusicAppWidgetProvider3x1";
-
-       public static final String CMDAPPWIDGETUPDATE = "appwidgetupdate3x1";
-
-       private static MediaAppWidgetProvider3x1 sInstance;
-
-       static synchronized MediaAppWidgetProvider3x1 getInstance() {
-               if (sInstance == null) {
-                       sInstance = new MediaAppWidgetProvider3x1();
-               }
-               return sInstance;
-       }
-
-       @Override
-       public void onUpdate(Context context, AppWidgetManager appWidgetManager,
-                       int[] appWidgetIds) {
-               defaultAppWidget(context, appWidgetIds);
-
-               // Send broadcast intent to any running MediaPlaybackService so it can
-               // wrap around with an immediate update.
-               Intent updateIntent = new Intent(MediaPlaybackService.SERVICECMD);
-               updateIntent.putExtra(MediaPlaybackService.CMDNAME,
-                               MediaAppWidgetProvider3x1.CMDAPPWIDGETUPDATE);
-               updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS,
-                               appWidgetIds);
-               updateIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
-               context.sendBroadcast(updateIntent);
-       }
-
-       /**
-        * Initialize given widgets to default state, where we launch Music on
-        * default click and hide actions if service not running.
-        */
-       private void defaultAppWidget(Context context, int[] appWidgetIds) {
-               final RemoteViews views = new RemoteViews(context.getPackageName(),
-                               R.layout.album_appwidget3x1);
-
-               views.setViewVisibility(R.id.albumart, View.VISIBLE);
-
-               linkButtons(context, views /* not playing */);
-               pushUpdate(context, appWidgetIds, views);
-       }
-
-       private void pushUpdate(Context context, int[] appWidgetIds,
-                       RemoteViews views) {
-               // Update specific list of appWidgetIds if given, otherwise default to
-               // all
-               final AppWidgetManager gm = AppWidgetManager.getInstance(context);
-               if (appWidgetIds != null) {
-                       gm.updateAppWidget(appWidgetIds, views);
-               } else {
-                       gm.updateAppWidget(new ComponentName(context, this.getClass()),
-                                       views);
-               }
-       }
-
-       /**
-        * Check against {@link AppWidgetManager} if there are any instances of this
-        * widget.
-        */
-       private boolean hasInstances(Context context) {
-               AppWidgetManager appWidgetManager = AppWidgetManager
-                               .getInstance(context);
-               int[] appWidgetIds = appWidgetManager
-                               .getAppWidgetIds(new ComponentName(context, this.getClass()));
-               return (appWidgetIds.length > 0);
-       }
-
-       /**
-        * Handle a change notification coming over from
-        * {@link MediaPlaybackService}
-        */
-       void notifyChange(MediaPlaybackService service, String what) {
-               if (hasInstances(service)) {
-                       if (MediaPlaybackService.META_CHANGED.equals(what)
-                                       || MediaPlaybackService.PLAYSTATE_CHANGED.equals(what)) {
-                               performUpdate(service, null);
-                       }
-               }
-       }
-
-       /**
-        * Update all active widget instances by pushing changes
-        */
-       void performUpdate(MediaPlaybackService service, int[] appWidgetIds) {
-               final Resources res = service.getResources();
-               final RemoteViews views = new RemoteViews(service.getPackageName(),
-                               R.layout.album_appwidget3x1);
-
-               CharSequence titleName = service.getTrackName();
-               CharSequence artistName = service.getArtistName();
-               long albumId = service.getAlbumId();
-               long songId = service.getAudioId();
-               CharSequence errorState = null;
-
-               // Format title string with track number, or show SD card message
-               String status = Environment.getExternalStorageState();
-               if (status.equals(Environment.MEDIA_SHARED)
-                               || status.equals(Environment.MEDIA_UNMOUNTED)) {
-                       if (android.os.Environment.isExternalStorageRemovable()) {
-                               errorState = res.getText(R.string.sdcard_busy_title);
-                       } else {
-                               errorState = res.getText(R.string.sdcard_busy_title_nosdcard);
-                       }
-               } else if (status.equals(Environment.MEDIA_REMOVED)) {
-                       if (android.os.Environment.isExternalStorageRemovable()) {
-                               errorState = res.getText(R.string.sdcard_missing_title);
-                       } else {
-                               errorState = res
-                                               .getText(R.string.sdcard_missing_title_nosdcard);
-                       }
-               } else if (titleName == null) {
-                       errorState = res.getText(R.string.emptyplaylist);
-               }
-
-               if (errorState != null) {
-                       // Show error state to user
-                       views.setViewVisibility(R.id.trackname, View.GONE);
-                       views.setTextViewText(R.id.artist, errorState);
-                       views.setViewVisibility(R.id.albumart, View.GONE);
-               } else {
-                       // No error, so show normal titles and artwork
-                       views.setViewVisibility(R.id.trackname, View.VISIBLE);
-                       views.setTextViewText(R.id.trackname, titleName);
-                       views.setTextViewText(R.id.artistname, artistName);
-                       views.setViewVisibility(R.id.albumart, View.VISIBLE);
-                       // Set album art
-                       Uri uri = MusicUtils.getArtworkUri(service, songId, albumId);
-                       if (uri != null) {
-                               views.setImageViewUri(R.id.albumart, uri);
-                       } else {
-                               views.setImageViewResource(R.id.albumart,
-                                               R.drawable.albumart_mp_unknown);
-                       }
-               }
-
-               // Link actions buttons to intents
-               linkButtons(service, views);
-
-               pushUpdate(service, appWidgetIds, views);
-       }
-
-       /**
-        * Link up various button actions using {@link PendingIntents}.
-        * 
-        * @param playerActive
-        *            True if player is active in background, which means widget
-        *            click will launch {@link MediaPlaybackActivity}, otherwise we
-        *            launch {@link MusicBrowserActivity}.
-        */
-       private void linkButtons(Context context, RemoteViews views) {
-               // Connect up various buttons and touch events
-               Intent intent;
-               PendingIntent pendingIntent;
-
-               final ComponentName serviceName = new ComponentName(context,
-                               MediaPlaybackService.class);
-
-               intent = new Intent(MediaPlaybackService.TOGGLEPAUSE_ACTION);
-               intent.setComponent(serviceName);
-               pendingIntent = PendingIntent.getService(context,
-                               0 /* no requestCode */, intent, 0 /* no flags */);
-               views.setOnClickPendingIntent(R.id.albumart, pendingIntent);
-
-               intent = new Intent(MediaPlaybackService.NEXT_ACTION);
-               intent.setComponent(serviceName);
-               pendingIntent = PendingIntent.getService(context,
-                               0 /* no requestCode */, intent, 0 /* no flags */);
-               views.setOnClickPendingIntent(R.id.next, pendingIntent);
-
-               intent = new Intent(MediaPlaybackService.PREVIOUS_ACTION);
-               intent.setComponent(serviceName);
-               pendingIntent = PendingIntent.getService(context,
-                               0 /* no requestCode */, intent, 0 /* no flags */);
-               views.setOnClickPendingIntent(R.id.previous, pendingIntent);
-       }
-}
+/*\r
+ * Copyright (C) 2009 The Android Open Source Project\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package com.android.music;\r
+\r
+import android.app.PendingIntent;\r
+import android.appwidget.AppWidgetManager;\r
+import android.appwidget.AppWidgetProvider;\r
+import android.content.ComponentName;\r
+import android.content.Context;\r
+import android.content.Intent;\r
+import android.content.res.Resources;\r
+import android.net.Uri;\r
+import android.os.Environment;\r
+import android.view.View;\r
+import android.widget.RemoteViews;\r
+\r
+/**\r
+ * Simple widget to show currently playing album art along with play/pause and\r
+ * next track buttons.\r
+ */\r
+public class MediaAppWidgetProvider3x1 extends AppWidgetProvider {\r
+       static final String TAG = "MusicAppWidgetProvider3x1";\r
+\r
+       public static final String CMDAPPWIDGETUPDATE = "appwidgetupdate3x1";\r
+\r
+       private static MediaAppWidgetProvider3x1 sInstance;\r
+\r
+       static synchronized MediaAppWidgetProvider3x1 getInstance() {\r
+               if (sInstance == null) {\r
+                       sInstance = new MediaAppWidgetProvider3x1();\r
+               }\r
+               return sInstance;\r
+       }\r
+\r
+       @Override\r
+       public void onUpdate(Context context, AppWidgetManager appWidgetManager,\r
+                       int[] appWidgetIds) {\r
+               defaultAppWidget(context, appWidgetIds);\r
+\r
+               // Send broadcast intent to any running MediaPlaybackService so it can\r
+               // wrap around with an immediate update.\r
+               Intent updateIntent = new Intent(MediaPlaybackService.SERVICECMD);\r
+               updateIntent.putExtra(MediaPlaybackService.CMDNAME,\r
+                               MediaAppWidgetProvider3x1.CMDAPPWIDGETUPDATE);\r
+               updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS,\r
+                               appWidgetIds);\r
+               updateIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);\r
+               context.sendBroadcast(updateIntent);\r
+       }\r
+\r
+       /**\r
+        * Initialize given widgets to default state, where we launch Music on\r
+        * default click and hide actions if service not running.\r
+        */\r
+       private void defaultAppWidget(Context context, int[] appWidgetIds) {\r
+               final RemoteViews views = new RemoteViews(context.getPackageName(),\r
+                               R.layout.album_appwidget3x1);\r
+\r
+               views.setViewVisibility(R.id.albumart, View.VISIBLE);\r
+\r
+               linkButtons(context, views /* not playing */);\r
+               pushUpdate(context, appWidgetIds, views);\r
+       }\r
+\r
+       private void pushUpdate(Context context, int[] appWidgetIds,\r
+                       RemoteViews views) {\r
+               // Update specific list of appWidgetIds if given, otherwise default to\r
+               // all\r
+               final AppWidgetManager gm = AppWidgetManager.getInstance(context);\r
+               if (appWidgetIds != null) {\r
+                       gm.updateAppWidget(appWidgetIds, views);\r
+               } else {\r
+                       gm.updateAppWidget(new ComponentName(context, this.getClass()),\r
+                                       views);\r
+               }\r
+       }\r
+\r
+       /**\r
+        * Check against {@link AppWidgetManager} if there are any instances of this\r
+        * widget.\r
+        */\r
+       private boolean hasInstances(Context context) {\r
+               AppWidgetManager appWidgetManager = AppWidgetManager\r
+                               .getInstance(context);\r
+               int[] appWidgetIds = appWidgetManager\r
+                               .getAppWidgetIds(new ComponentName(context, this.getClass()));\r
+               return (appWidgetIds.length > 0);\r
+       }\r
+\r
+       /**\r
+        * Handle a change notification coming over from\r
+        * {@link MediaPlaybackService}\r
+        */\r
+       void notifyChange(MediaPlaybackService service, String what) {\r
+               if (hasInstances(service)) {\r
+                       if (MediaPlaybackService.META_CHANGED.equals(what)\r
+                                       || MediaPlaybackService.PLAYSTATE_CHANGED.equals(what)) {\r
+                               performUpdate(service, null);\r
+                       }\r
+               }\r
+       }\r
+\r
+       /**\r
+        * Update all active widget instances by pushing changes\r
+        */\r
+       void performUpdate(MediaPlaybackService service, int[] appWidgetIds) {\r
+               final Resources res = service.getResources();\r
+               final RemoteViews views = new RemoteViews(service.getPackageName(),\r
+                               R.layout.album_appwidget3x1);\r
+\r
+               CharSequence titleName = service.getTrackName();\r
+               CharSequence artistName = service.getArtistName();\r
+               long albumId = service.getAlbumId();\r
+               long songId = service.getAudioId();\r
+               CharSequence errorState = null;\r
+\r
+               // Format title string with track number, or show SD card message\r
+               String status = Environment.getExternalStorageState();\r
+               if (status.equals(Environment.MEDIA_SHARED)\r
+                               || status.equals(Environment.MEDIA_UNMOUNTED)) {\r
+                       if (android.os.Environment.isExternalStorageRemovable()) {\r
+                               errorState = res.getText(R.string.sdcard_busy_title);\r
+                       } else {\r
+                               errorState = res.getText(R.string.sdcard_busy_title_nosdcard);\r
+                       }\r
+               } else if (status.equals(Environment.MEDIA_REMOVED)) {\r
+                       if (android.os.Environment.isExternalStorageRemovable()) {\r
+                               errorState = res.getText(R.string.sdcard_missing_title);\r
+                       } else {\r
+                               errorState = res\r
+                                               .getText(R.string.sdcard_missing_title_nosdcard);\r
+                       }\r
+               } else if (titleName == null) {\r
+                       errorState = res.getText(R.string.emptyplaylist);\r
+               }\r
+\r
+               if (errorState != null) {\r
+                       // Show error state to user\r
+                       views.setViewVisibility(R.id.trackname, View.GONE);\r
+                       views.setTextViewText(R.id.artist, errorState);\r
+                       views.setViewVisibility(R.id.albumart, View.GONE);\r
+               } else {\r
+                       // No error, so show normal titles and artwork\r
+                       views.setViewVisibility(R.id.trackname, View.VISIBLE);\r
+                       views.setTextViewText(R.id.trackname, titleName);\r
+                       views.setTextViewText(R.id.artistname, artistName);\r
+                       views.setViewVisibility(R.id.albumart, View.VISIBLE);\r
+                       // Set album art\r
+                       Uri uri = MusicUtils.getArtworkUri(service, songId, albumId);\r
+                       if (uri != null) {\r
+                               views.setImageViewUri(R.id.albumart, uri);\r
+                       } else {\r
+                               views.setImageViewResource(R.id.albumart,\r
+                                               R.drawable.albumart_mp_unknown);\r
+                       }\r
+               }\r
+\r
+               // Link actions buttons to intents\r
+               linkButtons(service, views);\r
+\r
+               pushUpdate(service, appWidgetIds, views);\r
+       }\r
+\r
+       /**\r
+        * Link up various button actions using {@link PendingIntents}.\r
+        * \r
+        * @param playerActive\r
+        *            True if player is active in background, which means widget\r
+        *            click will launch {@link MediaPlaybackActivity}, otherwise we\r
+        *            launch {@link MusicBrowserActivity}.\r
+        */\r
+       private void linkButtons(Context context, RemoteViews views) {\r
+               // Connect up various buttons and touch events\r
+               Intent intent;\r
+               PendingIntent pendingIntent;\r
+\r
+               final ComponentName serviceName = new ComponentName(context,\r
+                               MediaPlaybackService.class);\r
+\r
+               intent = new Intent(MediaPlaybackService.TOGGLEPAUSE_ACTION);\r
+               intent.setComponent(serviceName);\r
+               pendingIntent = PendingIntent.getService(context,\r
+                               0 /* no requestCode */, intent, 0 /* no flags */);\r
+               views.setOnClickPendingIntent(R.id.albumart, pendingIntent);\r
+\r
+               intent = new Intent(MediaPlaybackService.NEXT_ACTION);\r
+               intent.setComponent(serviceName);\r
+               pendingIntent = PendingIntent.getService(context,\r
+                               0 /* no requestCode */, intent, 0 /* no flags */);\r
+               views.setOnClickPendingIntent(R.id.next, pendingIntent);\r
+\r
+               intent = new Intent(MediaPlaybackService.PREVIOUS_ACTION);\r
+               intent.setComponent(serviceName);\r
+               pendingIntent = PendingIntent.getService(context,\r
+                               0 /* no requestCode */, intent, 0 /* no flags */);\r
+               views.setOnClickPendingIntent(R.id.previous, pendingIntent);\r
+       }\r
+}\r
index babd0ab..b9097f1 100644 (file)
-/*
- * Copyright (C) 2009 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.
- */
-
-package com.android.music;
-
-import android.app.PendingIntent;
-import android.appwidget.AppWidgetManager;
-import android.appwidget.AppWidgetProvider;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.res.Resources;
-import android.graphics.Color;
-import android.net.Uri;
-import android.os.Environment;
-import android.preference.PreferenceManager;
-import android.view.View;
-import android.widget.RemoteViews;
-
-/**
- * Simple widget to show currently playing album art along with play/pause and
- * next track buttons.
- */
-
-public class MediaAppWidgetProvider4x1 extends AppWidgetProvider {
-       static final String TAG = "MusicAppWidgetProvider";
-
-       public static final String CMDAPPWIDGETUPDATE = "appwidgetupdate";
-
-       private static MediaAppWidgetProvider4x1 sInstance;
-
-       static synchronized MediaAppWidgetProvider4x1 getInstance() {
-               if (sInstance == null) {
-                       sInstance = new MediaAppWidgetProvider4x1();
-               }
-               return sInstance;
-       }
-
-       @Override
-       public void onUpdate(Context context, AppWidgetManager appWidgetManager,
-                       int[] appWidgetIds) {
-               defaultAppWidget(context, appWidgetIds);
-
-               // Send broadcast intent to any running MediaPlaybackService so it can
-               // wrap around with an immediate update.
-               Intent updateIntent = new Intent(MediaPlaybackService.SERVICECMD);
-               updateIntent.putExtra(MediaPlaybackService.CMDNAME,
-                               MediaAppWidgetProvider4x1.CMDAPPWIDGETUPDATE);
-               updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS,
-                               appWidgetIds);
-               updateIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
-               context.sendBroadcast(updateIntent);
-       }
-
-       /**
-        * Initialize given widgets to default state, where we launch Music on
-        * default click and hide actions if service not running.
-        */
-       private void defaultAppWidget(Context context, int[] appWidgetIds) {
-               final Resources res = context.getResources();
-               final RemoteViews views = new RemoteViews(context.getPackageName(),
-                               R.layout.album_appwidget4x1);
-
-               views.setViewVisibility(R.id.title, View.GONE);
-               views.setTextViewText(R.id.artist,
-                               res.getText(R.string.widget_initial_text));
-               views.setViewVisibility(R.id.albumart, View.GONE);
-
-               linkButtons(context, views, false /* not playing */);
-               pushUpdate(context, appWidgetIds, views);
-       }
-
-       private void pushUpdate(Context context, int[] appWidgetIds,
-                       RemoteViews views) {
-               // Update specific list of appWidgetIds if given, otherwise default to
-               // all
-               final AppWidgetManager gm = AppWidgetManager.getInstance(context);
-               if (appWidgetIds != null) {
-                       gm.updateAppWidget(appWidgetIds, views);
-               } else {
-                       gm.updateAppWidget(new ComponentName(context, this.getClass()),
-                                       views);
-               }
-       }
-
-       /**
-        * Check against {@link AppWidgetManager} if there are any instances of this
-        * widget.
-        */
-       private boolean hasInstances(Context context) {
-               AppWidgetManager appWidgetManager = AppWidgetManager
-                               .getInstance(context);
-               int[] appWidgetIds = appWidgetManager
-                               .getAppWidgetIds(new ComponentName(context, this.getClass()));
-               return (appWidgetIds.length > 0);
-       }
-
-       /**
-        * Handle a change notification coming over from
-        * {@link MediaPlaybackService}
-        */
-       void notifyChange(MediaPlaybackService service, String what) {
-               if (hasInstances(service)) {
-                       if (MediaPlaybackService.META_CHANGED.equals(what)
-                                       || MediaPlaybackService.PLAYSTATE_CHANGED.equals(what)) {
-                               performUpdate(service, null);
-                       }
-               }
-       }
-
-       /**
-        * Update all active widget instances by pushing changes
-        */
-       void performUpdate(MediaPlaybackService service, int[] appWidgetIds) {
-               final Resources res = service.getResources();
-               final RemoteViews views = new RemoteViews(service.getPackageName(),
-                               R.layout.album_appwidget4x1);
-
-               CharSequence titleName = service.getTrackName();
-               CharSequence artistName = service.getArtistName();
-               long albumId = service.getAlbumId();
-               long songId = service.getAudioId();
-               CharSequence errorState = null;
-
-               // Format title string with track number, or show SD card message
-               String status = Environment.getExternalStorageState();
-               if (status.equals(Environment.MEDIA_SHARED)
-                               || status.equals(Environment.MEDIA_UNMOUNTED)) {
-                       if (android.os.Environment.isExternalStorageRemovable()) {
-                               errorState = res.getText(R.string.sdcard_busy_title);
-                       } else {
-                               errorState = res.getText(R.string.sdcard_busy_title_nosdcard);
-                       }
-               } else if (status.equals(Environment.MEDIA_REMOVED)) {
-                       if (android.os.Environment.isExternalStorageRemovable()) {
-                               errorState = res.getText(R.string.sdcard_missing_title);
-                       } else {
-                               errorState = res
-                                               .getText(R.string.sdcard_missing_title_nosdcard);
-                       }
-               } else if (titleName == null) {
-                       errorState = res.getText(R.string.emptyplaylist);
-               }
-
-               SharedPreferences mPrefs = PreferenceManager
-                               .getDefaultSharedPreferences(service);
-               int aColor = new Integer(mPrefs.getInt(null,
-                               MusicSettingsActivity.DEFAULT_SCREENSAVER_COLOR_ALPHA));
-               int rColor = new Integer(mPrefs.getInt(null,
-                               MusicSettingsActivity.DEFAULT_SCREENSAVER_COLOR_RED));
-               int gColor = new Integer(mPrefs.getInt(null,
-                               MusicSettingsActivity.DEFAULT_SCREENSAVER_COLOR_GREEN));
-               int bColor = new Integer(mPrefs.getInt(null,
-                               MusicSettingsActivity.DEFAULT_SCREENSAVER_COLOR_BLUE));
-
-               int SCREEN_SAVER_COLOR_DIM = Color.argb(aColor, rColor, gColor, bColor);
-               if (errorState != null) {
-                       // Show error state to user
-                       views.setViewVisibility(R.id.title, View.GONE);
-                       views.setTextViewText(R.id.artist, errorState);
-                       views.setViewVisibility(R.id.albumart, View.GONE);
-               } else {
-                       // No error, so show normal titles and artwork
-                       views.setViewVisibility(R.id.title, View.VISIBLE);
-                       views.setTextViewText(R.id.title, titleName);
-                       views.setTextViewText(R.id.artist, artistName);
-                       views.setViewVisibility(R.id.albumart, View.VISIBLE);
-                       views.setTextColor(R.id.title, SCREEN_SAVER_COLOR_DIM);
-                       views.setTextColor(R.id.artist, SCREEN_SAVER_COLOR_DIM);
-                       // Set album art
-                       Uri uri = MusicUtils.getArtworkUri(service, songId, albumId);
-                       if (uri != null) {
-                               views.setImageViewUri(R.id.albumart, uri);
-                       } else {
-                               views.setImageViewResource(R.id.albumart,
-                                               R.drawable.albumart_mp_unknown);
-                       }
-               }
-
-               // Set correct drawable for pause state
-               final boolean playing = service.isPlaying();
-               if (playing) {
-                       views.setImageViewResource(R.id.control_play,
-                                       R.drawable.ic_media_pause);
-               } else {
-                       views.setImageViewResource(R.id.control_play,
-                                       R.drawable.ic_appwidget_music_play);
-               }
-
-               // Link actions buttons to intents
-               linkButtons(service, views, playing);
-
-               pushUpdate(service, appWidgetIds, views);
-       }
-
-       /**
-        * Link up various button actions using {@link PendingIntents}.
-        * 
-        * @param playerActive
-        *            True if player is active in background, which means widget
-        *            click will launch {@link MediaPlaybackActivity}, otherwise we
-        *            launch {@link MusicBrowserActivity}.
-        */
-       private void linkButtons(Context context, RemoteViews views,
-                       boolean playerActive) {
-
-               // ADW: Load the specified theme
-               String themePackage = MusicUtils.getThemePackageName(context,
-                               MusicSettingsActivity.THEME_DEFAULT);
-               PackageManager pm = context.getPackageManager();
-               Resources themeResources = null;
-               if (!themePackage.equals(MusicSettingsActivity.THEME_DEFAULT)) {
-                       try {
-                               themeResources = pm.getResourcesForApplication(themePackage);
-                       } catch (NameNotFoundException e) {
-                               // ADW The saved theme was uninstalled so we save the
-                               // default one
-                               MusicUtils.setThemePackageName(context,
-                                               MusicSettingsActivity.THEME_DEFAULT);
-                       }
-                       int trackName = themeResources.getIdentifier(
-                                       "four_by_one_track_name", "color", themePackage);
-                       if (trackName != 0) {
-                               views.setTextColor(R.id.trackname,
-                                               themeResources.getColor(trackName));
-                       }
-                       int artistName = themeResources.getIdentifier(
-                                       "four_by_one_artist_name", "color", themePackage);
-                       if (artistName != 0) {
-                               views.setTextColor(R.id.artistname,
-                                               themeResources.getColor(artistName));
-                       }
-               }
-               // Connect up various buttons and touch events
-               Intent intent;
-               PendingIntent pendingIntent;
-
-               final ComponentName serviceName = new ComponentName(context,
-                               MediaPlaybackService.class);
-
-               if (playerActive) {
-                       intent = new Intent(context, MediaPlaybackActivity.class);
-                       pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
-                       views.setOnClickPendingIntent(R.id.album_appwidget, pendingIntent);
-                       views.setOnClickPendingIntent(R.id.albumart, pendingIntent);
-               } else {
-                       intent = new Intent(context, MusicBrowserActivity.class);
-                       pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
-                       views.setOnClickPendingIntent(R.id.album_appwidget, pendingIntent);
-                       views.setOnClickPendingIntent(R.id.albumart, pendingIntent);
-               }
-
-               intent = new Intent(MediaPlaybackService.TOGGLEPAUSE_ACTION);
-               intent.setComponent(serviceName);
-               pendingIntent = PendingIntent.getService(context,
-                               0 /* no requestCode */, intent, 0 /* no flags */);
-               views.setOnClickPendingIntent(R.id.control_play, pendingIntent);
-
-               intent = new Intent(MediaPlaybackService.NEXT_ACTION);
-               intent.setComponent(serviceName);
-               pendingIntent = PendingIntent.getService(context,
-                               0 /* no requestCode */, intent, 0 /* no flags */);
-               views.setOnClickPendingIntent(R.id.control_next, pendingIntent);
-       }
-}
+/*\r
+ * Copyright (C) 2009 The Android Open Source Project\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package com.android.music;\r
+\r
+import android.app.PendingIntent;\r
+import android.appwidget.AppWidgetManager;\r
+import android.appwidget.AppWidgetProvider;\r
+import android.content.ComponentName;\r
+import android.content.Context;\r
+import android.content.Intent;\r
+import android.content.SharedPreferences;\r
+import android.content.pm.PackageManager;\r
+import android.content.pm.PackageManager.NameNotFoundException;\r
+import android.content.res.Resources;\r
+import android.graphics.Color;\r
+import android.net.Uri;\r
+import android.os.Environment;\r
+import android.preference.PreferenceManager;\r
+import android.view.View;\r
+import android.widget.RemoteViews;\r
+\r
+/**\r
+ * Simple widget to show currently playing album art along with play/pause and\r
+ * next track buttons.\r
+ */\r
+\r
+public class MediaAppWidgetProvider4x1 extends AppWidgetProvider {\r
+       static final String TAG = "MusicAppWidgetProvider";\r
+\r
+       public static final String CMDAPPWIDGETUPDATE = "appwidgetupdate";\r
+\r
+       private static MediaAppWidgetProvider4x1 sInstance;\r
+\r
+       static synchronized MediaAppWidgetProvider4x1 getInstance() {\r
+               if (sInstance == null) {\r
+                       sInstance = new MediaAppWidgetProvider4x1();\r
+               }\r
+               return sInstance;\r
+       }\r
+\r
+       @Override\r
+       public void onUpdate(Context context, AppWidgetManager appWidgetManager,\r
+                       int[] appWidgetIds) {\r
+               defaultAppWidget(context, appWidgetIds);\r
+\r
+               // Send broadcast intent to any running MediaPlaybackService so it can\r
+               // wrap around with an immediate update.\r
+               Intent updateIntent = new Intent(MediaPlaybackService.SERVICECMD);\r
+               updateIntent.putExtra(MediaPlaybackService.CMDNAME,\r
+                               MediaAppWidgetProvider4x1.CMDAPPWIDGETUPDATE);\r
+               updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS,\r
+                               appWidgetIds);\r
+               updateIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);\r
+               context.sendBroadcast(updateIntent);\r
+       }\r
+\r
+       /**\r
+        * Initialize given widgets to default state, where we launch Music on\r
+        * default click and hide actions if service not running.\r
+        */\r
+       private void defaultAppWidget(Context context, int[] appWidgetIds) {\r
+               final Resources res = context.getResources();\r
+               final RemoteViews views = new RemoteViews(context.getPackageName(),\r
+                               R.layout.album_appwidget4x1);\r
+\r
+               views.setViewVisibility(R.id.title, View.GONE);\r
+               views.setTextViewText(R.id.artist,\r
+                               res.getText(R.string.widget_initial_text));\r
+               views.setViewVisibility(R.id.albumart, View.GONE);\r
+\r
+               linkButtons(context, views, false /* not playing */);\r
+               pushUpdate(context, appWidgetIds, views);\r
+       }\r
+\r
+       private void pushUpdate(Context context, int[] appWidgetIds,\r
+                       RemoteViews views) {\r
+               // Update specific list of appWidgetIds if given, otherwise default to\r
+               // all\r
+               final AppWidgetManager gm = AppWidgetManager.getInstance(context);\r
+               if (appWidgetIds != null) {\r
+                       gm.updateAppWidget(appWidgetIds, views);\r
+               } else {\r
+                       gm.updateAppWidget(new ComponentName(context, this.getClass()),\r
+                                       views);\r
+               }\r
+       }\r
+\r
+       /**\r
+        * Check against {@link AppWidgetManager} if there are any instances of this\r
+        * widget.\r
+        */\r
+       private boolean hasInstances(Context context) {\r
+               AppWidgetManager appWidgetManager = AppWidgetManager\r
+                               .getInstance(context);\r
+               int[] appWidgetIds = appWidgetManager\r
+                               .getAppWidgetIds(new ComponentName(context, this.getClass()));\r
+               return (appWidgetIds.length > 0);\r
+       }\r
+\r
+       /**\r
+        * Handle a change notification coming over from\r
+        * {@link MediaPlaybackService}\r
+        */\r
+       void notifyChange(MediaPlaybackService service, String what) {\r
+               if (hasInstances(service)) {\r
+                       if (MediaPlaybackService.META_CHANGED.equals(what)\r
+                                       || MediaPlaybackService.PLAYSTATE_CHANGED.equals(what)) {\r
+                               performUpdate(service, null);\r
+                       }\r
+               }\r
+       }\r
+\r
+       /**\r
+        * Update all active widget instances by pushing changes\r
+        */\r
+       void performUpdate(MediaPlaybackService service, int[] appWidgetIds) {\r
+               final Resources res = service.getResources();\r
+               final RemoteViews views = new RemoteViews(service.getPackageName(),\r
+                               R.layout.album_appwidget4x1);\r
+\r
+               CharSequence titleName = service.getTrackName();\r
+               CharSequence artistName = service.getArtistName();\r
+               long albumId = service.getAlbumId();\r
+               long songId = service.getAudioId();\r
+               CharSequence errorState = null;\r
+\r
+               // Format title string with track number, or show SD card message\r
+               String status = Environment.getExternalStorageState();\r
+               if (status.equals(Environment.MEDIA_SHARED)\r
+                               || status.equals(Environment.MEDIA_UNMOUNTED)) {\r
+                       if (android.os.Environment.isExternalStorageRemovable()) {\r
+                               errorState = res.getText(R.string.sdcard_busy_title);\r
+                       } else {\r
+                               errorState = res.getText(R.string.sdcard_busy_title_nosdcard);\r
+                       }\r
+               } else if (status.equals(Environment.MEDIA_REMOVED)) {\r
+                       if (android.os.Environment.isExternalStorageRemovable()) {\r
+                               errorState = res.getText(R.string.sdcard_missing_title);\r
+                       } else {\r
+                               errorState = res\r
+                                               .getText(R.string.sdcard_missing_title_nosdcard);\r
+                       }\r
+               } else if (titleName == null) {\r
+                       errorState = res.getText(R.string.emptyplaylist);\r
+               }\r
+\r
+               SharedPreferences mPrefs = PreferenceManager\r
+                               .getDefaultSharedPreferences(service);\r
+               int aColor = new Integer(mPrefs.getInt(null,\r
+                               MusicSettingsActivity.DEFAULT_SCREENSAVER_COLOR_ALPHA));\r
+               int rColor = new Integer(mPrefs.getInt(null,\r
+                               MusicSettingsActivity.DEFAULT_SCREENSAVER_COLOR_RED));\r
+               int gColor = new Integer(mPrefs.getInt(null,\r
+                               MusicSettingsActivity.DEFAULT_SCREENSAVER_COLOR_GREEN));\r
+               int bColor = new Integer(mPrefs.getInt(null,\r
+                               MusicSettingsActivity.DEFAULT_SCREENSAVER_COLOR_BLUE));\r
+\r
+               int SCREEN_SAVER_COLOR_DIM = Color.argb(aColor, rColor, gColor, bColor);\r
+               if (errorState != null) {\r
+                       // Show error state to user\r
+                       views.setViewVisibility(R.id.title, View.GONE);\r
+                       views.setTextViewText(R.id.artist, errorState);\r
+                       views.setViewVisibility(R.id.albumart, View.GONE);\r
+               } else {\r
+                       // No error, so show normal titles and artwork\r
+                       views.setViewVisibility(R.id.title, View.VISIBLE);\r
+                       views.setTextViewText(R.id.title, titleName);\r
+                       views.setTextViewText(R.id.artist, artistName);\r
+                       views.setViewVisibility(R.id.albumart, View.VISIBLE);\r
+                       views.setTextColor(R.id.title, SCREEN_SAVER_COLOR_DIM);\r
+                       views.setTextColor(R.id.artist, SCREEN_SAVER_COLOR_DIM);\r
+                       // Set album art\r
+                       Uri uri = MusicUtils.getArtworkUri(service, songId, albumId);\r
+                       if (uri != null) {\r
+                               views.setImageViewUri(R.id.albumart, uri);\r
+                       } else {\r
+                               views.setImageViewResource(R.id.albumart,\r
+                                               R.drawable.albumart_mp_unknown);\r
+                       }\r
+               }\r
+\r
+               // Set correct drawable for pause state\r
+               final boolean playing = service.isPlaying();\r
+               if (playing) {\r
+                       views.setImageViewResource(R.id.control_play,\r
+                                       R.drawable.ic_media_pause);\r
+               } else {\r
+                       views.setImageViewResource(R.id.control_play,\r
+                                       R.drawable.ic_appwidget_music_play);\r
+               }\r
+\r
+               // Link actions buttons to intents\r
+               linkButtons(service, views, playing);\r
+\r
+               pushUpdate(service, appWidgetIds, views);\r
+       }\r
+\r
+       /**\r
+        * Link up various button actions using {@link PendingIntents}.\r
+        * \r
+        * @param playerActive\r
+        *            True if player is active in background, which means widget\r
+        *            click will launch {@link MediaPlaybackActivity}, otherwise we\r
+        *            launch {@link MusicBrowserActivity}.\r
+        */\r
+       private void linkButtons(Context context, RemoteViews views,\r
+                       boolean playerActive) {\r
+\r
+               // ADW: Load the specified theme\r
+               String themePackage = MusicUtils.getThemePackageName(context,\r
+                               MusicSettingsActivity.THEME_DEFAULT);\r
+               PackageManager pm = context.getPackageManager();\r
+               Resources themeResources = null;\r
+               if (!themePackage.equals(MusicSettingsActivity.THEME_DEFAULT)) {\r
+                       try {\r
+                               themeResources = pm.getResourcesForApplication(themePackage);\r
+                       } catch (NameNotFoundException e) {\r
+                               // ADW The saved theme was uninstalled so we save the\r
+                               // default one\r
+                               MusicUtils.setThemePackageName(context,\r
+                                               MusicSettingsActivity.THEME_DEFAULT);\r
+                       }\r
+                       int trackName = themeResources.getIdentifier(\r
+                                       "four_by_one_track_name", "color", themePackage);\r
+                       if (trackName != 0) {\r
+                               views.setTextColor(R.id.trackname,\r
+                                               themeResources.getColor(trackName));\r
+                       }\r
+                       int artistName = themeResources.getIdentifier(\r
+                                       "four_by_one_artist_name", "color", themePackage);\r
+                       if (artistName != 0) {\r
+                               views.setTextColor(R.id.artistname,\r
+                                               themeResources.getColor(artistName));\r
+                       }\r
+               }\r
+               // Connect up various buttons and touch events\r
+               Intent intent;\r
+               PendingIntent pendingIntent;\r
+\r
+               final ComponentName serviceName = new ComponentName(context,\r
+                               MediaPlaybackService.class);\r
+\r
+               if (playerActive) {\r
+                       intent = new Intent(context, MediaPlaybackActivity.class);\r
+                       pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);\r
+                       views.setOnClickPendingIntent(R.id.album_appwidget, pendingIntent);\r
+                       views.setOnClickPendingIntent(R.id.albumart, pendingIntent);\r
+               } else {\r
+                       intent = new Intent(context, MusicBrowserActivity.class);\r
+                       pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);\r
+                       views.setOnClickPendingIntent(R.id.album_appwidget, pendingIntent);\r
+                       views.setOnClickPendingIntent(R.id.albumart, pendingIntent);\r
+               }\r
+\r
+               intent = new Intent(MediaPlaybackService.TOGGLEPAUSE_ACTION);\r
+               intent.setComponent(serviceName);\r
+               pendingIntent = PendingIntent.getService(context,\r
+                               0 /* no requestCode */, intent, 0 /* no flags */);\r
+               views.setOnClickPendingIntent(R.id.control_play, pendingIntent);\r
+\r
+               intent = new Intent(MediaPlaybackService.NEXT_ACTION);\r
+               intent.setComponent(serviceName);\r
+               pendingIntent = PendingIntent.getService(context,\r
+                               0 /* no requestCode */, intent, 0 /* no flags */);\r
+               views.setOnClickPendingIntent(R.id.control_next, pendingIntent);\r
+       }\r
+}\r
index 8dd335d..21c4420 100644 (file)
-/*
- * Copyright (C) 2009 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.
- */
-
-package com.android.music;
-
-import android.app.PendingIntent;
-import android.appwidget.AppWidgetManager;
-import android.appwidget.AppWidgetProvider;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.res.Resources;
-import android.graphics.Color;
-import android.net.Uri;
-import android.os.Environment;
-import android.preference.PreferenceManager;
-import android.view.View;
-import android.widget.RemoteViews;
-
-/**
- * Simple widget to show currently playing album art along with play/pause and
- * next track buttons.
- */
-public class MediaAppWidgetProvider4x2 extends AppWidgetProvider {
-       static final String TAG = "MusicAppWidgetProvider4x2";
-
-       public static final String CMDAPPWIDGETUPDATE = "appwidgetupdate4x2";
-
-       // ADW Theme constants
-       public static final int THEME_ITEM_BACKGROUND = 0;
-       public static final int THEME_ITEM_FOREGROUND = 1;
-       private static MediaAppWidgetProvider4x2 sInstance;
-
-       static synchronized MediaAppWidgetProvider4x2 getInstance() {
-               if (sInstance == null) {
-                       sInstance = new MediaAppWidgetProvider4x2();
-               }
-               return sInstance;
-       }
-
-       @Override
-       public void onUpdate(Context context, AppWidgetManager appWidgetManager,
-                       int[] appWidgetIds) {
-               defaultAppWidget(context, appWidgetIds);
-
-               // Send broadcast intent to any running MediaPlaybackService so it can
-               // wrap around with an immediate update.
-               Intent updateIntent = new Intent(MediaPlaybackService.SERVICECMD);
-               updateIntent.putExtra(MediaPlaybackService.CMDNAME,
-                               MediaAppWidgetProvider4x2.CMDAPPWIDGETUPDATE);
-               updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS,
-                               appWidgetIds);
-               updateIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
-               context.sendBroadcast(updateIntent);
-       }
-
-       /**
-        * Initialize given widgets to default state, where we launch Music on
-        * default click and hide actions if service not running.
-        */
-       private void defaultAppWidget(Context context, int[] appWidgetIds) {
-               final Resources res = context.getResources();
-               final RemoteViews views = new RemoteViews(context.getPackageName(),
-                               R.layout.album_appwidget4x2);
-
-               views.setViewVisibility(R.id.albumname, View.GONE);
-               views.setViewVisibility(R.id.trackname, View.GONE);
-               views.setTextViewText(R.id.artistname,
-                               res.getText(R.string.widget_initial_text));
-               views.setImageViewResource(R.id.albumart,
-                               R.drawable.albumart_mp_unknown);
-
-               linkButtons(context, views, false /* not playing */);
-               pushUpdate(context, appWidgetIds, views);
-       }
-
-       private void pushUpdate(Context context, int[] appWidgetIds,
-                       RemoteViews views) {
-               // Update specific list of appWidgetIds if given, otherwise default to
-               // all
-               final AppWidgetManager gm = AppWidgetManager.getInstance(context);
-               if (appWidgetIds != null) {
-                       gm.updateAppWidget(appWidgetIds, views);
-               } else {
-                       gm.updateAppWidget(new ComponentName(context, this.getClass()),
-                                       views);
-               }
-       }
-
-       /**
-        * Check against {@link AppWidgetManager} if there are any instances of this
-        * widget.
-        */
-       private boolean hasInstances(Context context) {
-               AppWidgetManager appWidgetManager = AppWidgetManager
-                               .getInstance(context);
-               int[] appWidgetIds = appWidgetManager
-                               .getAppWidgetIds(new ComponentName(context, this.getClass()));
-               return (appWidgetIds.length > 0);
-       }
-
-       /**
-        * Handle a change notification coming over from
-        * {@link MediaPlaybackService}
-        */
-       void notifyChange(MediaPlaybackService service, String what) {
-               if (hasInstances(service)) {
-                       if (MediaPlaybackService.META_CHANGED.equals(what)
-                                       || MediaPlaybackService.PROGRESSBAR_CHANGED.equals(what)
-                                       || MediaPlaybackService.PLAYSTATE_CHANGED.equals(what)
-                                       || MediaPlaybackService.REPEATMODE_CHANGED.equals(what)
-                                       || MediaPlaybackService.SHUFFLEMODE_CHANGED.equals(what)) {
-                               performUpdate(service, null);
-                       }
-               }
-       }
-
-       /**
-        * Update all active widget instances by pushing changes
-        */
-       void performUpdate(MediaPlaybackService service, int[] appWidgetIds) {
-               final Resources res = service.getResources();
-               final RemoteViews views = new RemoteViews(service.getPackageName(),
-                               R.layout.album_appwidget4x2);
-
-               CharSequence artistName = service.getArtistName();
-               CharSequence albumName = service.getAlbumName();
-               CharSequence trackName = service.getTrackName();
-               long albumId = service.getAlbumId();
-               long songId = service.getAudioId();
-               long pos = service.position();
-               long dur = service.duration();
-               CharSequence errorState = null;
-
-               // Format title string with track number, or show SD card message
-               String status = Environment.getExternalStorageState();
-               if (status.equals(Environment.MEDIA_SHARED)
-                               || status.equals(Environment.MEDIA_UNMOUNTED)) {
-                       if (android.os.Environment.isExternalStorageRemovable()) {
-                               errorState = res.getText(R.string.sdcard_busy_title);
-                       } else {
-                               errorState = res.getText(R.string.sdcard_busy_title_nosdcard);
-                       }
-               } else if (status.equals(Environment.MEDIA_REMOVED)) {
-                       if (android.os.Environment.isExternalStorageRemovable()) {
-                               errorState = res.getText(R.string.sdcard_missing_title);
-                       } else {
-                               errorState = res
-                                               .getText(R.string.sdcard_missing_title_nosdcard);
-                       }
-               } else if (trackName == null) {
-                       errorState = res.getText(R.string.emptyplaylist);
-               }
-               SharedPreferences mPrefs = PreferenceManager
-                               .getDefaultSharedPreferences(service);
-               int aColor = new Integer(mPrefs.getInt(null,
-                               MusicSettingsActivity.DEFAULT_SCREENSAVER_COLOR_ALPHA));
-               int rColor = new Integer(mPrefs.getInt(null,
-                               MusicSettingsActivity.DEFAULT_SCREENSAVER_COLOR_RED));
-               int gColor = new Integer(mPrefs.getInt(null,
-                               MusicSettingsActivity.DEFAULT_SCREENSAVER_COLOR_GREEN));
-               int bColor = new Integer(mPrefs.getInt(null,
-                               MusicSettingsActivity.DEFAULT_SCREENSAVER_COLOR_BLUE));
-               int SCREEN_SAVER_COLOR_DIM = Color.argb(aColor, rColor, gColor, bColor);
-
-               if (errorState != null) {
-                       // Show error state to user
-                       views.setViewVisibility(R.id.albumname, View.GONE);
-                       views.setViewVisibility(R.id.trackname, View.GONE);
-                       views.setTextViewText(R.id.artistname, errorState);
-                       views.setImageViewResource(R.id.albumart,
-                                       R.drawable.albumart_mp_unknown);
-               } else {
-                       // No error, so show normal titles and artwork
-                       views.setViewVisibility(R.id.albumname, View.VISIBLE);
-                       views.setViewVisibility(R.id.trackname, View.VISIBLE);
-                       views.setTextViewText(R.id.artistname, "  " + artistName);
-                       views.setTextViewText(R.id.albumname, "  " + albumName);
-                       views.setTextViewText(R.id.trackname, "  " + trackName);
-                       views.setTextColor(R.id.artistname, SCREEN_SAVER_COLOR_DIM);
-                       views.setTextColor(R.id.albumname, SCREEN_SAVER_COLOR_DIM);
-                       views.setTextColor(R.id.trackname, SCREEN_SAVER_COLOR_DIM);
-                       views.setProgressBar(R.id.progress, 1000, (int) (1000 * pos / dur),
-                                       false);
-
-                       // Set album art
-                       Uri uri = MusicUtils.getArtworkUri(service, songId, albumId);
-                       if (uri != null) {
-                               views.setImageViewUri(R.id.albumart, uri);
-                       } else {
-                               views.setImageViewResource(R.id.albumart,
-                                               R.drawable.albumart_mp_unknown);
-                       }
-               }
-
-               // Set correct drawable for pause state
-               final boolean playing = service.isPlaying();
-               if (playing) {
-                       views.setImageViewResource(R.id.control_play,
-                                       R.drawable.ic_media_pause);
-               } else {
-                       views.setImageViewResource(R.id.control_play,
-                                       R.drawable.ic_appwidget_music_play);
-               }
-
-               // Set correct drawable for repeat state
-               switch (service.getRepeatMode()) {
-               case MediaPlaybackService.REPEAT_ALL:
-                       views.setImageViewResource(R.id.control_repeat,
-                                       R.drawable.ic_mp_repeat_all_btn);
-                       break;
-               case MediaPlaybackService.REPEAT_CURRENT:
-                       views.setImageViewResource(R.id.control_repeat,
-                                       R.drawable.ic_mp_repeat_once_btn);
-                       break;
-               default:
-                       views.setImageViewResource(R.id.control_repeat,
-                                       R.drawable.ic_mp_repeat_off_btn);
-                       break;
-               }
-
-               // Set correct drawable for shuffle state
-               switch (service.getShuffleMode()) {
-               case MediaPlaybackService.SHUFFLE_NONE:
-                       views.setImageViewResource(R.id.control_shuffle,
-                                       R.drawable.ic_mp_shuffle_off_btn);
-                       break;
-               case MediaPlaybackService.SHUFFLE_AUTO:
-                       views.setImageViewResource(R.id.control_shuffle,
-                                       R.drawable.ic_mp_partyshuffle_on_btn);
-                       break;
-               default:
-                       views.setImageViewResource(R.id.control_shuffle,
-                                       R.drawable.ic_mp_shuffle_on_btn);
-                       break;
-               }
-               // Link actions buttons to intents
-               linkButtons(service, views, playing);
-
-               pushUpdate(service, appWidgetIds, views);
-
-       }
-
-       /**
-        * Link up various button actions using {@link PendingIntents}.
-        * 
-        * @param playerActive
-        *            True if player is active in background, which means widget
-        *            click will launch {@link MediaPlaybackActivity}, otherwise we
-        *            launch {@link MusicBrowserActivity}.
-        */
-       private void linkButtons(Context context, RemoteViews views,
-                       boolean playerActive) {
-
-               // ADW: Load the specified theme
-               String themePackage = MusicUtils.getThemePackageName(context,
-                               MusicSettingsActivity.THEME_DEFAULT);
-               PackageManager pm = context.getPackageManager();
-               Resources themeResources = null;
-               if (!themePackage.equals(MusicSettingsActivity.THEME_DEFAULT)) {
-                       try {
-                               themeResources = pm.getResourcesForApplication(themePackage);
-                       } catch (NameNotFoundException e) {
-                               // ADW The saved theme was uninstalled so we save the
-                               // default one
-                               MusicUtils.setThemePackageName(context,
-                                               MusicSettingsActivity.THEME_DEFAULT);
-                       }
-                       int albumName = themeResources.getIdentifier(
-                                       "four_by_two_album_name", "color", themePackage);
-                       if (albumName != 0) {
-                               views.setTextColor(R.id.albumname,
-                                               themeResources.getColor(albumName));
-                       }
-                       int trackName = themeResources.getIdentifier(
-                                       "four_by_two_track_name", "color", themePackage);
-                       if (trackName != 0) {
-                               views.setTextColor(R.id.trackname,
-                                               themeResources.getColor(trackName));
-                       }
-                       int artistName = themeResources.getIdentifier(
-                                       "four_by_two_artist_name", "color", themePackage);
-                       if (artistName != 0) {
-                               views.setTextColor(R.id.artistname,
-                                               themeResources.getColor(artistName));
-                       }
-               }
-
-               // Connect up various buttons and touch events
-               Intent intent;
-               PendingIntent pendingIntent;
-
-               final ComponentName serviceName = new ComponentName(context,
-                               MediaPlaybackService.class);
-
-               if (playerActive) {
-                       intent = new Intent(context, MediaPlaybackActivity.class);
-                       pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
-                       views.setOnClickPendingIntent(R.id.albumart, pendingIntent);
-                       views.setOnClickPendingIntent(R.id.info, pendingIntent);
-               } else {
-                       intent = new Intent(context, MusicBrowserActivity.class);
-                       pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
-                       views.setOnClickPendingIntent(R.id.albumart, pendingIntent);
-                       views.setOnClickPendingIntent(R.id.info, pendingIntent);
-               }
-
-               intent = new Intent(MediaPlaybackService.TOGGLEPAUSE_ACTION);
-               intent.setComponent(serviceName);
-               pendingIntent = PendingIntent.getService(context, 0, intent, 0);
-               views.setOnClickPendingIntent(R.id.control_play, pendingIntent);
-
-               intent = new Intent(MediaPlaybackService.NEXT_ACTION);
-               intent.setComponent(serviceName);
-               pendingIntent = PendingIntent.getService(context, 0, intent, 0);
-               views.setOnClickPendingIntent(R.id.control_next, pendingIntent);
-
-               intent = new Intent(MediaPlaybackService.PREVIOUS_ACTION);
-               intent.setComponent(serviceName);
-               pendingIntent = PendingIntent.getService(context, 0, intent, 0);
-               views.setOnClickPendingIntent(R.id.control_prev, pendingIntent);
-
-               intent = new Intent(MediaPlaybackService.CYCLEREPEAT_ACTION);
-               intent.setComponent(serviceName);
-               pendingIntent = PendingIntent.getService(context, 0, intent, 0);
-               views.setOnClickPendingIntent(R.id.control_repeat, pendingIntent);
-
-               intent = new Intent(MediaPlaybackService.TOGGLESHUFFLE_ACTION);
-               intent.setComponent(serviceName);
-               pendingIntent = PendingIntent.getService(context, 0, intent, 0);
-               views.setOnClickPendingIntent(R.id.control_shuffle, pendingIntent);
-       }
-}
+/*\r
+ * Copyright (C) 2009 The Android Open Source Project\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package com.android.music;\r
+\r
+import android.app.PendingIntent;\r
+import android.appwidget.AppWidgetManager;\r
+import android.appwidget.AppWidgetProvider;\r
+import android.content.ComponentName;\r
+import android.content.Context;\r
+import android.content.Intent;\r
+import android.content.SharedPreferences;\r
+import android.content.pm.PackageManager;\r
+import android.content.pm.PackageManager.NameNotFoundException;\r
+import android.content.res.Resources;\r
+import android.graphics.Color;\r
+import android.net.Uri;\r
+import android.os.Environment;\r
+import android.preference.PreferenceManager;\r
+import android.view.View;\r
+import android.widget.RemoteViews;\r
+\r
+/**\r
+ * Simple widget to show currently playing album art along with play/pause and\r
+ * next track buttons.\r
+ */\r
+public class MediaAppWidgetProvider4x2 extends AppWidgetProvider {\r
+       static final String TAG = "MusicAppWidgetProvider4x2";\r
+\r
+       public static final String CMDAPPWIDGETUPDATE = "appwidgetupdate4x2";\r
+\r
+       // ADW Theme constants\r
+       public static final int THEME_ITEM_BACKGROUND = 0;\r
+       public static final int THEME_ITEM_FOREGROUND = 1;\r
+       private static MediaAppWidgetProvider4x2 sInstance;\r
+\r
+       static synchronized MediaAppWidgetProvider4x2 getInstance() {\r
+               if (sInstance == null) {\r
+                       sInstance = new MediaAppWidgetProvider4x2();\r
+               }\r
+               return sInstance;\r
+       }\r
+\r
+       @Override\r
+       public void onUpdate(Context context, AppWidgetManager appWidgetManager,\r
+                       int[] appWidgetIds) {\r
+               defaultAppWidget(context, appWidgetIds);\r
+\r
+               // Send broadcast intent to any running MediaPlaybackService so it can\r
+               // wrap around with an immediate update.\r
+               Intent updateIntent = new Intent(MediaPlaybackService.SERVICECMD);\r
+               updateIntent.putExtra(MediaPlaybackService.CMDNAME,\r
+                               MediaAppWidgetProvider4x2.CMDAPPWIDGETUPDATE);\r
+               updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS,\r
+                               appWidgetIds);\r
+               updateIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);\r
+               context.sendBroadcast(updateIntent);\r
+       }\r
+\r
+       /**\r
+        * Initialize given widgets to default state, where we launch Music on\r
+        * default click and hide actions if service not running.\r
+        */\r
+       private void defaultAppWidget(Context context, int[] appWidgetIds) {\r
+               final Resources res = context.getResources();\r
+               final RemoteViews views = new RemoteViews(context.getPackageName(),\r
+                               R.layout.album_appwidget4x2);\r
+\r
+               views.setViewVisibility(R.id.albumname, View.GONE);\r
+               views.setViewVisibility(R.id.trackname, View.GONE);\r
+               views.setTextViewText(R.id.artistname,\r
+                               res.getText(R.string.widget_initial_text));\r
+               views.setImageViewResource(R.id.albumart,\r
+                               R.drawable.albumart_mp_unknown);\r
+\r
+               linkButtons(context, views, false /* not playing */);\r
+               pushUpdate(context, appWidgetIds, views);\r
+       }\r
+\r
+       private void pushUpdate(Context context, int[] appWidgetIds,\r
+                       RemoteViews views) {\r
+               // Update specific list of appWidgetIds if given, otherwise default to\r
+               // all\r
+               final AppWidgetManager gm = AppWidgetManager.getInstance(context);\r
+               if (appWidgetIds != null) {\r
+                       gm.updateAppWidget(appWidgetIds, views);\r
+               } else {\r
+                       gm.updateAppWidget(new ComponentName(context, this.getClass()),\r
+                                       views);\r
+               }\r
+       }\r
+\r
+       /**\r
+        * Check against {@link AppWidgetManager} if there are any instances of this\r
+        * widget.\r
+        */\r
+       private boolean hasInstances(Context context) {\r
+               AppWidgetManager appWidgetManager = AppWidgetManager\r
+                               .getInstance(context);\r
+               int[] appWidgetIds = appWidgetManager\r
+                               .getAppWidgetIds(new ComponentName(context, this.getClass()));\r
+               return (appWidgetIds.length > 0);\r
+       }\r
+\r
+       /**\r
+        * Handle a change notification coming over from\r
+        * {@link MediaPlaybackService}\r
+        */\r
+       void notifyChange(MediaPlaybackService service, String what) {\r
+               if (hasInstances(service)) {\r
+                       if (MediaPlaybackService.META_CHANGED.equals(what)\r
+                                       || MediaPlaybackService.PROGRESSBAR_CHANGED.equals(what)\r
+                                       || MediaPlaybackService.PLAYSTATE_CHANGED.equals(what)\r
+                                       || MediaPlaybackService.REPEATMODE_CHANGED.equals(what)\r
+                                       || MediaPlaybackService.SHUFFLEMODE_CHANGED.equals(what)) {\r
+                               performUpdate(service, null);\r
+                       }\r
+               }\r
+       }\r
+\r
+       /**\r
+        * Update all active widget instances by pushing changes\r
+        */\r
+       void performUpdate(MediaPlaybackService service, int[] appWidgetIds) {\r
+               final Resources res = service.getResources();\r
+               final RemoteViews views = new RemoteViews(service.getPackageName(),\r
+                               R.layout.album_appwidget4x2);\r
+\r
+               CharSequence artistName = service.getArtistName();\r
+               CharSequence albumName = service.getAlbumName();\r
+               CharSequence trackName = service.getTrackName();\r
+               long albumId = service.getAlbumId();\r
+               long songId = service.getAudioId();\r
+               long pos = service.position();\r
+               long dur = service.duration();\r
+               CharSequence errorState = null;\r
+\r
+               // Format title string with track number, or show SD card message\r
+               String status = Environment.getExternalStorageState();\r
+               if (status.equals(Environment.MEDIA_SHARED)\r
+                               || status.equals(Environment.MEDIA_UNMOUNTED)) {\r
+                       if (android.os.Environment.isExternalStorageRemovable()) {\r
+                               errorState = res.getText(R.string.sdcard_busy_title);\r
+                       } else {\r
+                               errorState = res.getText(R.string.sdcard_busy_title_nosdcard);\r
+                       }\r
+               } else if (status.equals(Environment.MEDIA_REMOVED)) {\r
+                       if (android.os.Environment.isExternalStorageRemovable()) {\r
+                               errorState = res.getText(R.string.sdcard_missing_title);\r
+                       } else {\r
+                               errorState = res\r
+                                               .getText(R.string.sdcard_missing_title_nosdcard);\r
+                       }\r
+               } else if (trackName == null) {\r
+                       errorState = res.getText(R.string.emptyplaylist);\r
+               }\r
+               SharedPreferences mPrefs = PreferenceManager\r
+                               .getDefaultSharedPreferences(service);\r
+               int aColor = new Integer(mPrefs.getInt(null,\r
+                               MusicSettingsActivity.DEFAULT_SCREENSAVER_COLOR_ALPHA));\r
+               int rColor = new Integer(mPrefs.getInt(null,\r
+                               MusicSettingsActivity.DEFAULT_SCREENSAVER_COLOR_RED));\r
+               int gColor = new Integer(mPrefs.getInt(null,\r
+                               MusicSettingsActivity.DEFAULT_SCREENSAVER_COLOR_GREEN));\r
+               int bColor = new Integer(mPrefs.getInt(null,\r
+                               MusicSettingsActivity.DEFAULT_SCREENSAVER_COLOR_BLUE));\r
+               int SCREEN_SAVER_COLOR_DIM = Color.argb(aColor, rColor, gColor, bColor);\r
+\r
+               if (errorState != null) {\r
+                       // Show error state to user\r
+                       views.setViewVisibility(R.id.albumname, View.GONE);\r
+                       views.setViewVisibility(R.id.trackname, View.GONE);\r
+                       views.setTextViewText(R.id.artistname, errorState);\r
+                       views.setImageViewResource(R.id.albumart,\r
+                                       R.drawable.albumart_mp_unknown);\r
+               } else {\r
+                       // No error, so show normal titles and artwork\r
+                       views.setViewVisibility(R.id.albumname, View.VISIBLE);\r
+                       views.setViewVisibility(R.id.trackname, View.VISIBLE);\r
+                       views.setTextViewText(R.id.artistname, "  " + artistName);\r
+                       views.setTextViewText(R.id.albumname, "  " + albumName);\r
+                       views.setTextViewText(R.id.trackname, "  " + trackName);\r
+                       views.setTextColor(R.id.artistname, SCREEN_SAVER_COLOR_DIM);\r
+                       views.setTextColor(R.id.albumname, SCREEN_SAVER_COLOR_DIM);\r
+                       views.setTextColor(R.id.trackname, SCREEN_SAVER_COLOR_DIM);\r
+                       views.setProgressBar(R.id.progress, 1000, (int) (1000 * pos / dur),\r
+                                       false);\r
+\r
+                       // Set album art\r
+                       Uri uri = MusicUtils.getArtworkUri(service, songId, albumId);\r
+                       if (uri != null) {\r
+                               views.setImageViewUri(R.id.albumart, uri);\r
+                       } else {\r
+                               views.setImageViewResource(R.id.albumart,\r
+                                               R.drawable.albumart_mp_unknown);\r
+                       }\r
+               }\r
+\r
+               // Set correct drawable for pause state\r
+               final boolean playing = service.isPlaying();\r
+               if (playing) {\r
+                       views.setImageViewResource(R.id.control_play,\r
+                                       R.drawable.ic_media_pause);\r
+               } else {\r
+                       views.setImageViewResource(R.id.control_play,\r
+                                       R.drawable.ic_appwidget_music_play);\r
+               }\r
+\r
+               // Set correct drawable for repeat state\r
+               switch (service.getRepeatMode()) {\r
+               case MediaPlaybackService.REPEAT_ALL:\r
+                       views.setImageViewResource(R.id.control_repeat,\r
+                                       R.drawable.ic_mp_repeat_all_btn);\r
+                       break;\r
+               case MediaPlaybackService.REPEAT_CURRENT:\r
+                       views.setImageViewResource(R.id.control_repeat,\r
+                                       R.drawable.ic_mp_repeat_once_btn);\r
+                       break;\r
+               default:\r
+                       views.setImageViewResource(R.id.control_repeat,\r
+                                       R.drawable.ic_mp_repeat_off_btn);\r
+                       break;\r
+               }\r
+\r
+               // Set correct drawable for shuffle state\r
+               switch (service.getShuffleMode()) {\r
+               case MediaPlaybackService.SHUFFLE_NONE:\r
+                       views.setImageViewResource(R.id.control_shuffle,\r
+                                       R.drawable.ic_mp_shuffle_off_btn);\r
+                       break;\r
+               case MediaPlaybackService.SHUFFLE_AUTO:\r
+                       views.setImageViewResource(R.id.control_shuffle,\r
+                                       R.drawable.ic_mp_partyshuffle_on_btn);\r
+                       break;\r
+               default:\r
+                       views.setImageViewResource(R.id.control_shuffle,\r
+                                       R.drawable.ic_mp_shuffle_on_btn);\r
+                       break;\r
+               }\r
+               // Link actions buttons to intents\r
+               linkButtons(service, views, playing);\r
+\r
+               pushUpdate(service, appWidgetIds, views);\r
+\r
+       }\r
+\r
+       /**\r
+        * Link up various button actions using {@link PendingIntents}.\r
+        * \r
+        * @param playerActive\r
+        *            True if player is active in background, which means widget\r
+        *            click will launch {@link MediaPlaybackActivity}, otherwise we\r
+        *            launch {@link MusicBrowserActivity}.\r
+        */\r
+       private void linkButtons(Context context, RemoteViews views,\r
+                       boolean playerActive) {\r
+\r
+               // ADW: Load the specified theme\r
+               String themePackage = MusicUtils.getThemePackageName(context,\r
+                               MusicSettingsActivity.THEME_DEFAULT);\r
+               PackageManager pm = context.getPackageManager();\r
+               Resources themeResources = null;\r
+               if (!themePackage.equals(MusicSettingsActivity.THEME_DEFAULT)) {\r
+                       try {\r
+                               themeResources = pm.getResourcesForApplication(themePackage);\r
+                       } catch (NameNotFoundException e) {\r
+                               // ADW The saved theme was uninstalled so we save the\r
+                               // default one\r
+                               MusicUtils.setThemePackageName(context,\r
+                                               MusicSettingsActivity.THEME_DEFAULT);\r
+                       }\r
+                       int albumName = themeResources.getIdentifier(\r
+                                       "four_by_two_album_name", "color", themePackage);\r
+                       if (albumName != 0) {\r
+                               views.setTextColor(R.id.albumname,\r
+                                               themeResources.getColor(albumName));\r
+                       }\r
+                       int trackName = themeResources.getIdentifier(\r
+                                       "four_by_two_track_name", "color", themePackage);\r
+                       if (trackName != 0) {\r
+                               views.setTextColor(R.id.trackname,\r
+                                               themeResources.getColor(trackName));\r
+                       }\r
+                       int artistName = themeResources.getIdentifier(\r
+                                       "four_by_two_artist_name", "color", themePackage);\r
+                       if (artistName != 0) {\r
+                               views.setTextColor(R.id.artistname,\r
+                                               themeResources.getColor(artistName));\r
+                       }\r
+               }\r
+\r
+               // Connect up various buttons and touch events\r
+               Intent intent;\r
+               PendingIntent pendingIntent;\r
+\r
+               final ComponentName serviceName = new ComponentName(context,\r
+                               MediaPlaybackService.class);\r
+\r
+               if (playerActive) {\r
+                       intent = new Intent(context, MediaPlaybackActivity.class);\r
+                       pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);\r
+                       views.setOnClickPendingIntent(R.id.albumart, pendingIntent);\r
+                       views.setOnClickPendingIntent(R.id.info, pendingIntent);\r
+               } else {\r
+                       intent = new Intent(context, MusicBrowserActivity.class);\r
+                       pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);\r
+                       views.setOnClickPendingIntent(R.id.albumart, pendingIntent);\r
+                       views.setOnClickPendingIntent(R.id.info, pendingIntent);\r
+               }\r
+\r
+               intent = new Intent(MediaPlaybackService.TOGGLEPAUSE_ACTION);\r
+               intent.setComponent(serviceName);\r
+               pendingIntent = PendingIntent.getService(context, 0, intent, 0);\r
+               views.setOnClickPendingIntent(R.id.control_play, pendingIntent);\r
+\r
+               intent = new Intent(MediaPlaybackService.NEXT_ACTION);\r
+               intent.setComponent(serviceName);\r
+               pendingIntent = PendingIntent.getService(context, 0, intent, 0);\r
+               views.setOnClickPendingIntent(R.id.control_next, pendingIntent);\r
+\r
+               intent = new Intent(MediaPlaybackService.PREVIOUS_ACTION);\r
+               intent.setComponent(serviceName);\r
+               pendingIntent = PendingIntent.getService(context, 0, intent, 0);\r
+               views.setOnClickPendingIntent(R.id.control_prev, pendingIntent);\r
+\r
+               intent = new Intent(MediaPlaybackService.CYCLEREPEAT_ACTION);\r
+               intent.setComponent(serviceName);\r
+               pendingIntent = PendingIntent.getService(context, 0, intent, 0);\r
+               views.setOnClickPendingIntent(R.id.control_repeat, pendingIntent);\r
+\r
+               intent = new Intent(MediaPlaybackService.TOGGLESHUFFLE_ACTION);\r
+               intent.setComponent(serviceName);\r
+               pendingIntent = PendingIntent.getService(context, 0, intent, 0);\r
+               views.setOnClickPendingIntent(R.id.control_shuffle, pendingIntent);\r
+       }\r
+}\r
index 9a8b810..fadda52 100644 (file)
-/*
- * Copyright (C) 2007 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.
- */
-
-package com.android.music;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.media.AudioManager;
-import android.os.Handler;
-import android.os.Message;
-import android.view.KeyEvent;
-
-/**
- * 
- */
-public class MediaButtonIntentReceiver extends BroadcastReceiver {
-
-       private static final int MSG_LONGPRESS_TIMEOUT = 1;
-
-       private static final int LONG_PRESS_DELAY = 1000;
-
-       private static long mLastClickTime = 0;
-       private static boolean mDown = false;
-       private static boolean mLaunched = false;
-
-       private static Handler mHandler = new Handler() {
-               @Override
-               public void handleMessage(Message msg) {
-                       switch (msg.what) {
-                       case MSG_LONGPRESS_TIMEOUT:
-                               if (!mLaunched) {
-                                       Context context = (Context) msg.obj;
-                                       Intent i = new Intent();
-                                       i.putExtra("autoshuffle", "true");
-                                       i.setClass(context, MusicBrowserActivity.class);
-                                       i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
-                                                       | Intent.FLAG_ACTIVITY_CLEAR_TOP);
-                                       context.startActivity(i);
-                                       mLaunched = true;
-                               }
-                               break;
-                       }
-               }
-       };
-
-       @Override
-       public void onReceive(Context context, Intent intent) {
-               String intentAction = intent.getAction();
-
-               if (AudioManager.ACTION_AUDIO_BECOMING_NOISY.equals(intentAction)) {
-                       Intent i = new Intent(context, MediaPlaybackService.class);
-                       i.setAction(MediaPlaybackService.SERVICECMD);
-                       i.putExtra(MediaPlaybackService.CMDNAME,
-                                       MediaPlaybackService.CMDPAUSE);
-                       context.startService(i);
-               } else if (Intent.ACTION_MEDIA_BUTTON.equals(intentAction)) {
-                       KeyEvent event = (KeyEvent) intent
-                                       .getParcelableExtra(Intent.EXTRA_KEY_EVENT);
-
-                       if (event == null) {
-                               return;
-                       }
-
-                       int keycode = event.getKeyCode();
-                       int action = event.getAction();
-                       long eventtime = event.getEventTime();
-                       int buttonId = intent.getIntExtra(MediaPlaybackService.CMDNOTIF, 0);
-
-                       // single quick press: pause/resume.
-                       // double press: next track
-                       // long press: start auto-shuffle mode.
-
-                       String command = null;
-                       switch (keycode) {
-                       case KeyEvent.KEYCODE_MEDIA_STOP:
-                               command = MediaPlaybackService.CMDSTOP;
-                               break;
-                       case KeyEvent.KEYCODE_HEADSETHOOK:
-                       case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
-                               command = MediaPlaybackService.CMDTOGGLEPAUSE;
-
-                               break;
-                       case KeyEvent.KEYCODE_MEDIA_NEXT:
-                               command = MediaPlaybackService.CMDNEXT;
-
-                               break;
-                       case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
-                               command = MediaPlaybackService.CMDPREVIOUS;
-
-                               break;
-
-                       }
-
-                       if (command != null) {
-                               if (action == KeyEvent.ACTION_DOWN) {
-                                       if (mDown && (buttonId == 0)) {
-                                               if ((MediaPlaybackService.CMDTOGGLEPAUSE
-                                                               .equals(command) || MediaPlaybackService.CMDPLAY
-                                                               .equals(command))
-                                                               && mLastClickTime != 0
-                                                               && eventtime - mLastClickTime > LONG_PRESS_DELAY) {
-                                                       mHandler.sendMessage(mHandler.obtainMessage(
-                                                                       MSG_LONGPRESS_TIMEOUT, context));
-
-                                               }
-                                       } else if (event.getRepeatCount() == 0) {
-
-                                               // only consider the first event in a sequence, not the
-                                               // repeat events,
-                                               // so that we don't trigger in cases where the first
-                                               // event went to
-                                               // a different app (e.g. when the user ends a phone call
-                                               // by
-                                               // long pressing the headset button)
-
-                                               // The service may or may not be running, but we need to
-                                               // send it
-
-                                               // a command.
-                                               Intent i = new Intent(context,
-                                                               MediaPlaybackService.class);
-
-                                               i.setAction(MediaPlaybackService.SERVICECMD);
-                                               if (keycode == KeyEvent.KEYCODE_HEADSETHOOK
-                                                               && eventtime - mLastClickTime < 300) {
-                                                       i.putExtra(MediaPlaybackService.CMDNAME,
-                                                                       MediaPlaybackService.CMDNEXT);
-
-                                                       context.startService(i);
-                                                       mLastClickTime = 0;
-                                               } else {
-                                                       i.putExtra(MediaPlaybackService.CMDNAME, command);
-                                                       context.startService(i);
-                                                       mLastClickTime = eventtime;
-
-                                               }
-
-                                               mLaunched = false;
-                                               if (buttonId == 0) {
-                                                       mDown = true;
-
-                                               }
-                                       }
-                               } else {
-                                       mHandler.removeMessages(MSG_LONGPRESS_TIMEOUT);
-                                       mDown = false;
-
-                               }
-                               if (isOrderedBroadcast()) {
-                                       abortBroadcast();
-
-                               }
-                       }
-               }
-       }
-}
+/*\r
+ * Copyright (C) 2007 The Android Open Source Project\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package com.android.music;\r
+\r
+import android.content.BroadcastReceiver;\r
+import android.content.Context;\r
+import android.content.Intent;\r
+import android.media.AudioManager;\r
+import android.os.Handler;\r
+import android.os.Message;\r
+import android.view.KeyEvent;\r
+\r
+/**\r
+ * \r
+ */\r
+public class MediaButtonIntentReceiver extends BroadcastReceiver {\r
+\r
+       private static final int MSG_LONGPRESS_TIMEOUT = 1;\r
+\r
+       private static final int LONG_PRESS_DELAY = 1000;\r
+\r
+       private static long mLastClickTime = 0;\r
+       private static boolean mDown = false;\r
+       private static boolean mLaunched = false;\r
+\r
+       private static Handler mHandler = new Handler() {\r
+               @Override\r
+               public void handleMessage(Message msg) {\r
+                       switch (msg.what) {\r
+                       case MSG_LONGPRESS_TIMEOUT:\r
+                               if (!mLaunched) {\r
+                                       Context context = (Context) msg.obj;\r
+                                       Intent i = new Intent();\r
+                                       i.putExtra("autoshuffle", "true");\r
+                                       i.setClass(context, MusicBrowserActivity.class);\r
+                                       i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK\r
+                                                       | Intent.FLAG_ACTIVITY_CLEAR_TOP);\r
+                                       context.startActivity(i);\r
+                                       mLaunched = true;\r
+                               }\r
+                               break;\r
+                       }\r
+               }\r
+       };\r
+\r
+       @Override\r
+       public void onReceive(Context context, Intent intent) {\r
+               String intentAction = intent.getAction();\r
+\r
+               if (AudioManager.ACTION_AUDIO_BECOMING_NOISY.equals(intentAction)) {\r
+                       Intent i = new Intent(context, MediaPlaybackService.class);\r
+                       i.setAction(MediaPlaybackService.SERVICECMD);\r
+                       i.putExtra(MediaPlaybackService.CMDNAME,\r
+                                       MediaPlaybackService.CMDPAUSE);\r
+                       context.startService(i);\r
+               } else if (Intent.ACTION_MEDIA_BUTTON.equals(intentAction)) {\r
+                       KeyEvent event = (KeyEvent) intent\r
+                                       .getParcelableExtra(Intent.EXTRA_KEY_EVENT);\r
+\r
+                       if (event == null) {\r
+                               return;\r
+                       }\r
+\r
+                       int keycode = event.getKeyCode();\r
+                       int action = event.getAction();\r
+                       long eventtime = event.getEventTime();\r
+                       int buttonId = intent.getIntExtra(MediaPlaybackService.CMDNOTIF, 0);\r
+\r
+                       // single quick press: pause/resume.\r
+                       // double press: next track\r
+                       // long press: start auto-shuffle mode.\r
+\r
+                       String command = null;\r
+                       switch (keycode) {\r
+                       case KeyEvent.KEYCODE_MEDIA_STOP:\r
+                               command = MediaPlaybackService.CMDSTOP;\r
+                               break;\r
+                       case KeyEvent.KEYCODE_HEADSETHOOK:\r
+                       case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:\r
+                               command = MediaPlaybackService.CMDTOGGLEPAUSE;\r
+\r
+                               break;\r
+                       case KeyEvent.KEYCODE_MEDIA_NEXT:\r
+                               command = MediaPlaybackService.CMDNEXT;\r
+\r
+                               break;\r
+                       case KeyEvent.KEYCODE_MEDIA_PREVIOUS:\r
+                               command = MediaPlaybackService.CMDPREVIOUS;\r
+\r
+                               break;\r
+\r
+                       }\r
+\r
+                       if (command != null) {\r
+                               if (action == KeyEvent.ACTION_DOWN) {\r
+                                       if (mDown && (buttonId == 0)) {\r
+                                               if ((MediaPlaybackService.CMDTOGGLEPAUSE\r
+                                                               .equals(command) || MediaPlaybackService.CMDPLAY\r
+                                                               .equals(command))\r
+                                                               && mLastClickTime != 0\r
+                                                               && eventtime - mLastClickTime > LONG_PRESS_DELAY) {\r
+                                                       mHandler.sendMessage(mHandler.obtainMessage(\r
+                                                                       MSG_LONGPRESS_TIMEOUT, context));\r
+\r
+                                               }\r
+                                       } else if (event.getRepeatCount() == 0) {\r
+\r
+                                               // only consider the first event in a sequence, not the\r
+                                               // repeat events,\r
+                                               // so that we don't trigger in cases where the first\r
+                                               // event went to\r
+                                               // a different app (e.g. when the user ends a phone call\r
+                                               // by\r
+                                               // long pressing the headset button)\r
+\r
+                                               // The service may or may not be running, but we need to\r
+                                               // send it\r
+\r
+                                               // a command.\r
+                                               Intent i = new Intent(context,\r
+                                                               MediaPlaybackService.class);\r
+\r
+                                               i.setAction(MediaPlaybackService.SERVICECMD);\r
+                                               if (keycode == KeyEvent.KEYCODE_HEADSETHOOK\r
+                                                               && eventtime - mLastClickTime < 300) {\r
+                                                       i.putExtra(MediaPlaybackService.CMDNAME,\r
+                                                                       MediaPlaybackService.CMDNEXT);\r
+\r
+                                                       context.startService(i);\r
+                                                       mLastClickTime = 0;\r
+                                               } else {\r
+                                                       i.putExtra(MediaPlaybackService.CMDNAME, command);\r
+                                                       context.startService(i);\r
+                                                       mLastClickTime = eventtime;\r
+\r
+                                               }\r
+\r
+                                               mLaunched = false;\r
+                                               if (buttonId == 0) {\r
+                                                       mDown = true;\r
+\r
+                                               }\r
+                                       }\r
+                               } else {\r
+                                       mHandler.removeMessages(MSG_LONGPRESS_TIMEOUT);\r
+                                       mDown = false;\r
+\r
+                               }\r
+                               if (isOrderedBroadcast()) {\r
+                                       abortBroadcast();\r
+\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+}\r
index 6b50845..5f9ef0b 100644 (file)
@@ -85,7 +85,7 @@ public class MediaPlaybackActivity extends Activity implements MusicUtils.Defs,
        private Toast mToast;
        private int mTouchSlop;
        private ServiceToken mToken;
-       // Media buttons
+       // Media buttons and theme stuff
        private RepeatingImageButton mPrevButton;
        private ImageButton mPauseButton;
        private RepeatingImageButton mNextButton;
@@ -109,6 +109,7 @@ public class MediaPlaybackActivity extends Activity implements MusicUtils.Defs,
        private LinearLayout mRingtone;
        private LinearLayout mShop;
        private LinearLayout mDelete;
+       private LinearLayout mNPBackground;
        // Screen on while playing/charging
        private boolean pluggedIn;
        // Animations
@@ -253,6 +254,9 @@ public class MediaPlaybackActivity extends Activity implements MusicUtils.Defs,
                }
                // Set Views for themes
                if (themeResources != null) {
+                       bar = (ActionBar) getActionBar();
+
+                       mNPBackground = (LinearLayout) findViewById(R.id.now_playing_bg);
                        mShuffleButton = ((LinearLayout) findViewById(R.id.shuffle));
                        mShuffleButtonText = (TextView) findViewById(R.id.shuffle_text);
                        mRepeatButton = ((LinearLayout) findViewById(R.id.repeat));
@@ -303,7 +307,7 @@ public class MediaPlaybackActivity extends Activity implements MusicUtils.Defs,
                                        .loadThemeResource(themeResources, themePackage, "np_ring",
                                                        mRingButton, THEME_ITEM_FOREGROUND);
                        ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
-                                       themePackage, "np_share", mShareButton,
+                                       themePackage, "np_share", mShareButtonImage,
                                        THEME_ITEM_FOREGROUND);
                        ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
                                        themePackage, "np_eq", mEQ, THEME_ITEM_FOREGROUND);
@@ -316,6 +320,15 @@ public class MediaPlaybackActivity extends Activity implements MusicUtils.Defs,
                        ArtistAlbumBrowserActivity
                                        .loadThemeResource(themeResources, themePackage, "np_next",
                                                        mPrevButton, THEME_ITEM_FOREGROUND);
+                       // Now Playing bg
+                       ArtistAlbumBrowserActivity
+                                       .loadThemeResource(themeResources, themePackage, "np_bg",
+                                                       mNPBackground, THEME_ITEM_BACKGROUND);
+                       int aBar = themeResources.getIdentifier("ab_bg", "drawable",
+                                       themePackage);
+                       if (aBar != 0) {
+                               bar.setBackgroundDrawable(themeResources.getDrawable(aBar));
+                       }
                        int seeker = themeResources.getIdentifier("progress_horizontal",
                                        "drawable", themePackage);
                        if (seeker != 0) {
index 17f2e68..67ec62b 100644 (file)
@@ -540,10 +540,6 @@ public class MediaPlaybackService extends Service implements
        public void onDestroy() {
                sensorMan.unregisterListener(this);
 
-               if (shaker != null)
-                       shaker.close();
-               shaker = null;
-
                // Check that we're not being destroyed while something is still
                // playing.
                if (isPlaying()) {
@@ -1654,6 +1650,7 @@ public class MediaPlaybackService extends Service implements
                if (remove_status_icon) {
                        mIsSupposedToBePlaying = false;
                }
+
        }
 
        /**
index 3a6cd7c..4ade0dc 100644 (file)
-/*
- * Copyright (C) 2011 The CyanogenMod 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.
- */
-
-package com.android.music;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.channels.FileChannel;
-import java.util.List;
-
-import android.app.ActionBar;
-import android.app.AlertDialog;
-import android.app.WallpaperManager;
-import android.content.ActivityNotFoundException;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.pm.ResolveInfo;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.media.audiofx.AudioEffect;
-import android.net.Uri;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.Environment;
-import android.os.SystemClock;
-import android.preference.CheckBoxPreference;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceManager;
-import android.preference.PreferenceScreen;
-import android.provider.MediaStore;
-import android.util.Log;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.Toast;
-
-public class MusicSettingsActivity extends PreferenceActivity implements
-               OnSharedPreferenceChangeListener, OnPreferenceChangeListener {
-
-       static final String KEY_ENABLE_FOCUS_LOSS_DUCKING = "enable_focus_loss_ducking";
-       static final String KEY_DUCK_ATTENUATION_DB = "duck_attenuation_db";
-       static final String KEY_BACK_BUTTON_DB = "back_button_db";
-       static final String KEY_ANIMATION_UI_DB = "animation_ui_db";
-       static final String KEY_ENABLE_GESTURES = "enable_gestures";
-       static final String KEY_ENABLE_HAPTIC_FEEDBACK = "enable_haptic_feedback";
-       static final String KEY_HAS_CUSTOM_GESTURES = "has_custom_gestures";
-       static final String KEY_ENABLE_SEARCH_BUTTON = "cbSearch";
-       static final String KEY_ENABLE_PLAY_BUTTON = "cbPlay";
-       static final String KEY_ENABLE_NEXT_BUTTON = "cbNext";
-       static final String KEY_ENABLE_PREV_BUTTON = "cbPrev";
-       static final String KEY_ENABLE_NEW_PLAYLIST_BUTTON = "cbPlaylist";
-       static final String KEY_ENABLE_ALBUM_ART = "cbArt";
-       static final String KEY_ENABLE_SONG_TEXT = "tvLine1";
-       static final String KEY_ENABLE_ARTIST_TEXT = "tvLine2";
-       static final String KEY_ENABLE_ALBUM_TEXT = "tvLine3";
-       static final String KEY_COLOR_PREFERENCE_KEY = "color";
-       static final String KEY_ENABLE_STATUS_PLAY_BUTTON = "cbStatusPlay";
-       static final String KEY_ENABLE_SHARE_BUTTON = "cbShare";
-       static final String KEY_ENABLE_PROGRESS_BAR = "cbProgress";
-       static final String KEY_ENABLE_OVER_FLOW = "cbFlow";
-
-       static final String KEY_ENABLE_STATUS_NEXT_BUTTON = "cbStatusNext";
-       static final String KEY_ENABLE_STATUS_PREV_BUTTON = "cbStatusPrev";
-       static final String KEY_ENABLE_STATUS_ALBUM_ART = "cbStatusArt";
-       static final String KEY_ENABLE_STATUS_SONG_TEXT = "tvStatusLine1";
-       static final String KEY_ENABLE_STATUS_ARTIST_TEXT = "tvStatusLine2";
-       static final String KEY_ENABLE_STATUS_ALBUM_TEXT = "tvStatusLine3";
-       static final String KEY_ENABLE_MARKET_SERACH = "cbMarket";
-       static final String KEY_ENABLE_STATUS_COLLAPSE = "cbStatusCollapse";
-       static final String SCREENSAVER_COLOR = "screensaver_color";
-       static final String SCREENSAVER_COLOR_ALPHA = "screensaver_color_alpha";
-       static final String SCREENSAVER_COLOR_RED = "screensaver_color_red";
-       static final String SCREENSAVER_COLOR_GREEN = "screensaver_color_green";
-       static final String SCREENSAVER_COLOR_BLUE = "screensaver_color_blue";
-       static final String KEY_ENTER_FULL_NOW_PLAYING = "cbEnterNowPlaying";
-       static final String KEY_ENABLE_STATUS_TEXT_COLOR = "tvStatusColor";
-       static final String KEY_ENABLE_HOME_ART = "cbHomeAlbumArt";
-       static final String KEY_LOCK = "cbLock";
-       public static final String THEME_DEFAULT = "Music";
-       static final String THEME_KEY = "themePackageName";
-       static final String SHAKE_SENSITIVITY = "shake_sensitivity";
-       static final String FLIP_SENSITIVITY = "flip_sensitivity";
-
-       // This key has the gesture entry name (E.g. PAUSE) appended to it before
-       // use
-       static final String KEY_HAS_CUSTOM_GESTURE_XXX = "has_custom_gesture_";
-
-       static final String DEFAULT_DUCK_ATTENUATION_DB = "8";
-       static final String DEFAULT_BACK_BUTTON_ACTION_DB = "0";
-
-       static final String ACTION_ENABLE_GESTURES_CHANGED = "com.android.music.enablegestureschanged";
-       static final String ACTION_GESTURES_CHANGED = "com.android.music.gestureschanged";
-
-       static final String PREFERENCES_FILE = "settings";
-       public static final String KEY_ENABLE_STATUS_NONYA = "cbStatusNonya";
-       public static final String KEY_BUILD_VERSION = "build";
-       public static final String KEY_SOUND_EFFECT = "eqEffects";
-       public static final String KEY_FEEDBACK = "feedback";
-       public static final String KEY_FLIP = "cbFlip";
-       public static final String KEY_TICK = "cbStatusTicker";
-
-       long[] mHits = new long[3];
-       private static final String LOG_TAG = "EasterEgg";
-       private static final int EFFECTS_PANEL = 0;
-
-       // Color to use for text & graphics in screen saver mode.
-       static final int DEFAULT_SCREENSAVER_COLOR_ALPHA = 230;
-       static final int DEFAULT_SCREENSAVER_COLOR_RED = 0;
-       static final int DEFAULT_SCREENSAVER_COLOR_GREEN = 192;
-       static final int DEFAULT_SCREENSAVER_COLOR_BLUE = 255;
-       // Custom wallpaper
-       static final String BG_PHOTO_FILE = "home_art";
-       static final String TEMP_PHOTO_FILE = "home";
-       private Bitmap bgBitmap = null;
-       // Shake and Flip sensitivity
-       static final double DEFAULT_SHAKE_SENS = 2;
-       static final int DEFAULT_FLIP_SENS = 10;
-
-       public AlertDialog themeAlert;
-       public CheckBoxPreference cp;
-
-       @Override
-       protected void onCreate(Bundle savedInstanceState) {
-               super.onCreate(savedInstanceState);
-
-               PreferenceManager preferenceManager = getPreferenceManager();
-               preferenceManager.setSharedPreferencesName(PREFERENCES_FILE);
-               addPreferencesFromResource(R.xml.settings);
-
-               ActionBar bar = getActionBar();
-               bar.setDisplayHomeAsUpEnabled(true);
-
-               PreferenceScreen screen;
-               screen = getPreferenceScreen();
-
-               cp = (CheckBoxPreference) screen.findPreference("cbHomeAlbumArt");
-
-               final CheckBoxPreference lk = (CheckBoxPreference) screen
-                               .findPreference("cbLock");
-
-               AlertDialog.Builder builder = new AlertDialog.Builder(this);
-               builder.setTitle("Set Wallpaper");
-               builder.setIcon(android.R.drawable.ic_menu_crop);
-               builder.setMessage(
-                               "You should select a wallpaper to use when your music is paused.")
-                               .setCancelable(false)
-                               .setPositiveButton("Okay",
-                                               new DialogInterface.OnClickListener() {
-                                                       public void onClick(DialogInterface dialog, int id) {
-                                                               pickImage();
-                                                       }
-                                               })
-                               .setNegativeButton("Cancel",
-                                               new DialogInterface.OnClickListener() {
-                                                       public void onClick(DialogInterface dialog, int id) {
-                                                               dialog.cancel();
-                                                               cp.setChecked(false);
-                                                       }
-                                               });
-               final AlertDialog alert = builder.create();
-
-               AlertDialog.Builder lock = new AlertDialog.Builder(this);
-               lock.setTitle("Requires Restart");
-               lock.setIcon(R.drawable.ic_dialog_alert_holo_dark);
-               lock.setMessage(
-                               "Music needs to stop completely and restart to let the changes take effect")
-                               .setCancelable(false)
-                               .setPositiveButton("Okay",
-                                               new DialogInterface.OnClickListener() {
-                                                       public void onClick(DialogInterface dialog, int id) {
-                                                               // This isn't a good practice, but we need to
-                                                               // restart the
-                                                               // service completely to see the change
-                                                               // immediately
-                                                               System.exit(0);
-                                                       }
-                                               })
-                               .setNegativeButton("Cancel",
-                                               new DialogInterface.OnClickListener() {
-                                                       public void onClick(DialogInterface dialog, int id) {
-                                                               dialog.cancel();
-                                                               if (lk.isChecked()) {
-                                                                       lk.setChecked(false);
-                                                               } else {
-                                                                       lk.setChecked(true);
-                                                               }
-                                                       }
-                                               });
-               final AlertDialog lockAlert = lock.create();
-
-               cp.setOnPreferenceClickListener(new OnPreferenceClickListener() {
-                       public boolean onPreferenceClick(final Preference preference) {
-                               CheckBoxPreference cbp = (CheckBoxPreference) preference;
-                               if (cbp.isChecked()) {
-                                       alert.show();
-                               } else {
-                                       // We don't want the wall paper to remain the album art if
-                                       // they aren't using this.
-                                       setCustomBackground();
-                               }
-                               return true;
-                       }
-               });
-
-               lk.setOnPreferenceClickListener(new OnPreferenceClickListener() {
-                       public boolean onPreferenceClick(final Preference preference) {
-                               lockAlert.show();
-                               return true;
-                       }
-               });
-
-               try {
-                       PackageInfo packageInfo = getPackageManager().getPackageInfo(
-                                       getPackageName(), 0);
-                       findPreference(KEY_BUILD_VERSION).setSummary(
-                                       Build.VERSION.RELEASE + " - " + packageInfo.versionName);
-               } catch (NameNotFoundException e) {
-                       findPreference(KEY_BUILD_VERSION).setSummary("?");
-               }
-               // ADW: theme settings
-               SharedPreferences sp = getPreferenceManager().getSharedPreferences();
-               final String themePackage = sp.getString(THEME_KEY, THEME_DEFAULT);
-               ListPreference themeLp = (ListPreference) findPreference(THEME_KEY);
-               themeLp.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
-                       public boolean onPreferenceChange(Preference preference,
-                                       Object newValue) {
-                               PreviewPreference themePreview = (PreviewPreference) findPreference("themePreview");
-                               themePreview.setTheme(newValue.toString());
-                               return false;
-                       }
-               });
-
-               Intent intent = new Intent("com.andrew.music.THEMES");
-               intent.addCategory("android.intent.category.DEFAULT");
-               PackageManager pm = getPackageManager();
-               List<ResolveInfo> themes = pm.queryIntentActivities(intent, 0);
-               String[] entries = new String[themes.size() + 1];
-               String[] values = new String[themes.size() + 1];
-               entries[0] = MusicSettingsActivity.THEME_DEFAULT;
-               values[0] = MusicSettingsActivity.THEME_DEFAULT;
-               for (int i = 0; i < themes.size(); i++) {
-                       String appPackageName = (themes.get(i)).activityInfo.packageName
-                                       .toString();
-                       String themeName = (themes.get(i)).loadLabel(pm).toString();
-                       entries[i + 1] = themeName;
-                       values[i + 1] = appPackageName;
-               }
-               themeLp.setEntries(entries);
-               themeLp.setEntryValues(values);
-               PreviewPreference themePreview = (PreviewPreference) findPreference("themePreview");
-               themePreview.setTheme(themePackage);
-       }
-
-       private void pickImage() {
-               Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
-               intent.setType("image/*");
-
-               intent.putExtra("crop", "true");
-               intent.putExtra("scale", true);
-               intent.putExtra("outputFormat", Bitmap.CompressFormat.PNG.toString());
-               intent.putExtra(MediaStore.EXTRA_OUTPUT, getTempUri());
-               intent.putExtra("noFaceDetection", true);
-
-               startActivityForResult(intent, 0);
-       }
-
-       private Uri getTempUri() {
-               return Uri.fromFile(getTempFile());
-       }
-
-       private File getTempFile() {
-               if (isSDCARDMounted()) {
-
-                       File f = new File(Environment.getExternalStorageDirectory(),
-                                       TEMP_PHOTO_FILE);
-                       // try {
-                       // f.createNewFile();
-                       // } catch (IOException e) {
-                       // TODO Auto-generated catch block
-                       // e.printStackTrace();
-                       // Toast.makeText(this, "Something Fucked Up",
-                       // Toast.LENGTH_LONG).show();
-                       // }
-                       return f;
-               } else {
-                       return null;
-               }
-       }
-
-       private boolean isSDCARDMounted() {
-               String status = Environment.getExternalStorageState();
-
-               if (status.equals(Environment.MEDIA_MOUNTED))
-                       return true;
-               return false;
-       }
-
-       public static void copyFile(File src, File dst) throws IOException {
-               FileChannel inChannel = new FileInputStream(src).getChannel();
-               FileChannel outChannel = new FileOutputStream(dst).getChannel();
-
-               try {
-                       inChannel.transferTo(0, inChannel.size(), outChannel);
-               } finally {
-
-                       if (inChannel != null)
-                               inChannel.close();
-                       if (outChannel != null)
-                               outChannel.close();
-               }
-       }
-
-       protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-               if (requestCode == 0) {
-                       if (resultCode == RESULT_OK) {
-                               try {
-
-                                       File src = getTempFile();
-                                       File dst = new File(getFilesDir(), BG_PHOTO_FILE);
-                                       copyFile(src, dst);
-
-                               } catch (FileNotFoundException e) {
-                                       // TODO Auto-generated catch block
-                                       e.printStackTrace();
-                               } catch (IOException e) {
-                                       // TODO Auto-generated catch block
-                                       e.printStackTrace();
-                               }
-                       }
-               }
-       }
-
-       // Set Custom Background Image
-       public void setCustomBackground() {
-
-               SharedPreferences preferences = getSharedPreferences(
-                               MusicSettingsActivity.PREFERENCES_FILE, MODE_PRIVATE);
-
-               preferences
-                               .getBoolean(MusicSettingsActivity.KEY_ENABLE_HOME_ART, false);
-
-               // First clean our old data
-               if (bgBitmap != null) {
-                       bgBitmap.recycle();
-                       bgBitmap = null;
-                       System.gc();
-               }
-               // now load the proper bg
-               String BG_FILE = getFilesDir().toString() + File.separator
-                               + MusicSettingsActivity.BG_PHOTO_FILE;
-               bgBitmap = BitmapFactory.decodeFile(BG_FILE);
-
-               try {
-                       WallpaperManager.getInstance(this).setBitmap(bgBitmap);
-               } catch (Exception e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }
-       }
-
-       public void applyTheme(View v) {
-               PreviewPreference themePreview = (PreviewPreference) findPreference("themePreview");
-               String packageName = themePreview.getValue().toString();
-               // this time we really save the themepackagename
-               SharedPreferences sp = getPreferenceManager().getSharedPreferences();
-               final SharedPreferences.Editor editor = sp.edit();
-               editor.putString("themePackageName", packageName);
-               // and update the preferences from the theme
-               // TODO:ADW maybe this should be optional for the user
-               if (!packageName.equals(MusicSettingsActivity.THEME_DEFAULT)) {
-                       Resources themeResources = null;
-                       try {
-                               themeResources = getPackageManager()
-                                               .getResourcesForApplication(packageName.toString());
-                       } catch (NameNotFoundException e) {
-                               // e.printStackTrace();
-                       }
-               } else {
-
-               }
-               AlertDialog.Builder theme = new AlertDialog.Builder(this);
-               theme.setTitle("Requires Restart");
-               theme.setIcon(R.drawable.ic_dialog_alert_holo_dark);
-               theme.setMessage(
-                               "Music needs to stop completely and restart to let the changes take effect")
-                               .setCancelable(false)
-                               .setPositiveButton("Okay",
-                                               new DialogInterface.OnClickListener() {
-                                                       public void onClick(DialogInterface dialog, int id) {
-                                                               editor.commit();
-                                                               // This isn't a good practice, but we need to
-                                                               // restart the
-                                                               // service completely to see the change
-                                                               // immediately
-                                                               System.exit(0);
-                                                       }
-                                               })
-                               .setNegativeButton("Cancel",
-                                               new DialogInterface.OnClickListener() {
-                                                       public void onClick(DialogInterface dialog, int id) {
-                                                               dialog.cancel();
-                                                       }
-                                               });
-               themeAlert = theme.create();
-               themeAlert.show();
-       }
-
-       public void getThemes(View v) {
-               // TODO:warn theme devs to use "MusicTheme" as keyword.
-               Uri marketUri = Uri.parse("market://search?q=MusicTheme");
-               Intent marketIntent = new Intent(Intent.ACTION_VIEW).setData(marketUri);
-               try {
-                       startActivity(marketIntent);
-               } catch (ActivityNotFoundException e) {
-                       Toast.makeText(this, R.string.activity_not_found,
-                                       Toast.LENGTH_SHORT).show();
-               } catch (SecurityException e) {
-                       Toast.makeText(this, R.string.activity_not_found,
-                                       Toast.LENGTH_SHORT).show();
-                       Log.e("Music", "Get themes", e);
-               }
-               finish();
-       }
-
-       @Override
-       public boolean onOptionsItemSelected(MenuItem item) {
-               switch (item.getItemId()) {
-               case android.R.id.home:
-                       super.onBackPressed();
-                       break;
-               }
-               return super.onOptionsItemSelected(item);
-       }
-
-       @Override
-       public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
-                       String key) {
-               if (key.equals(KEY_ENABLE_GESTURES)) {
-                       Intent intent = new Intent(ACTION_ENABLE_GESTURES_CHANGED);
-                       sendBroadcast(intent);
-               }
-       }
-
-       @Override
-       protected void onResume() {
-               super.onResume();
-               getPreferenceScreen().getSharedPreferences()
-                               .registerOnSharedPreferenceChangeListener(this);
-       }
-
-       @Override
-       protected void onPause() {
-               super.onPause();
-               getPreferenceScreen().getSharedPreferences()
-                               .unregisterOnSharedPreferenceChangeListener(this);
-       }
-
-       @Override
-       protected void onDestroy() {
-               super.onDestroy();
-
-       }
-
-       @Override
-       public boolean onPreferenceChange(Preference arg0, Object arg1) {
-               // TODO Auto-generated method stub
-               return false;
-       }
-
-       @Override
-       public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
-                       Preference preference) {
-               try {
-                       if (preference.getKey().equals(KEY_BUILD_VERSION)) {
-                               System.arraycopy(mHits, 1, mHits, 0, mHits.length - 1);
-                               mHits[mHits.length - 1] = SystemClock.uptimeMillis();
-                               if (mHits[0] >= (SystemClock.uptimeMillis() - 500)) {
-                                       Toast ImageToast = new Toast(getBaseContext());
-                                       LinearLayout toastLayout = new LinearLayout(
-                                                       getBaseContext());
-                                       toastLayout.setOrientation(LinearLayout.HORIZONTAL);
-                                       ImageView image = new ImageView(getBaseContext());
-                                       image.setImageResource(R.drawable.easter_egg);
-                                       toastLayout.addView(image);
-                                       ImageToast.setView(toastLayout);
-                                       ImageToast.setDuration(Toast.LENGTH_SHORT);
-                                       ImageToast.show();
-                               }
-                       }
-               } catch (NullPointerException ee) {
-
-               }
-               try {
-                       if (preference.getKey().equals(KEY_SOUND_EFFECT)) {
-                               Intent i = new Intent(
-                                               AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
-                               try {
-                                       i.putExtra(AudioEffect.EXTRA_AUDIO_SESSION,
-                                                       MusicUtils.sService.getAudioSessionId());
-                               } catch (Exception e) {
-                                       // TODO Auto-generated catch block
-                                       e.printStackTrace();
-                               }
-                               startActivityForResult(i, EFFECTS_PANEL);
-                       }
-               } catch (NullPointerException ee) {
-
-               }
-
-               return super.onPreferenceTreeClick(preferenceScreen, preference);
-       }
-}
+/*\r
+ * Copyright (C) 2011 The CyanogenMod Project\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package com.android.music;\r
+\r
+import java.io.File;\r
+import java.io.FileInputStream;\r
+import java.io.FileNotFoundException;\r
+import java.io.FileOutputStream;\r
+import java.io.IOException;\r
+import java.nio.channels.FileChannel;\r
+import java.util.List;\r
+\r
+import android.app.ActionBar;\r
+import android.app.AlertDialog;\r
+import android.app.WallpaperManager;\r
+import android.content.ActivityNotFoundException;\r
+import android.content.DialogInterface;\r
+import android.content.Intent;\r
+import android.content.SharedPreferences;\r
+import android.content.SharedPreferences.OnSharedPreferenceChangeListener;\r
+import android.content.pm.PackageInfo;\r
+import android.content.pm.PackageManager;\r
+import android.content.pm.PackageManager.NameNotFoundException;\r
+import android.content.pm.ResolveInfo;\r
+import android.content.res.Resources;\r
+import android.graphics.Bitmap;\r
+import android.graphics.BitmapFactory;\r
+import android.media.audiofx.AudioEffect;\r
+import android.net.Uri;\r
+import android.os.Build;\r
+import android.os.Bundle;\r
+import android.os.Environment;\r
+import android.os.SystemClock;\r
+import android.preference.CheckBoxPreference;\r
+import android.preference.ListPreference;\r
+import android.preference.Preference;\r
+import android.preference.Preference.OnPreferenceChangeListener;\r
+import android.preference.Preference.OnPreferenceClickListener;\r
+import android.preference.PreferenceActivity;\r
+import android.preference.PreferenceManager;\r
+import android.preference.PreferenceScreen;\r
+import android.provider.MediaStore;\r
+import android.util.Log;\r
+import android.view.MenuItem;\r
+import android.view.View;\r
+import android.widget.ImageView;\r
+import android.widget.LinearLayout;\r
+import android.widget.Toast;\r
+\r
+public class MusicSettingsActivity extends PreferenceActivity implements\r
+               OnSharedPreferenceChangeListener, OnPreferenceChangeListener {\r
+\r
+       static final String KEY_ENABLE_FOCUS_LOSS_DUCKING = "enable_focus_loss_ducking";\r
+       static final String KEY_DUCK_ATTENUATION_DB = "duck_attenuation_db";\r
+       static final String KEY_BACK_BUTTON_DB = "back_button_db";\r
+       static final String KEY_ANIMATION_UI_DB = "animation_ui_db";\r
+       static final String KEY_ENABLE_GESTURES = "enable_gestures";\r
+       static final String KEY_ENABLE_HAPTIC_FEEDBACK = "enable_haptic_feedback";\r
+       static final String KEY_HAS_CUSTOM_GESTURES = "has_custom_gestures";\r
+       static final String KEY_ENABLE_SEARCH_BUTTON = "cbSearch";\r
+       static final String KEY_ENABLE_PLAY_BUTTON = "cbPlay";\r
+       static final String KEY_ENABLE_NEXT_BUTTON = "cbNext";\r
+       static final String KEY_ENABLE_PREV_BUTTON = "cbPrev";\r
+       static final String KEY_ENABLE_NEW_PLAYLIST_BUTTON = "cbPlaylist";\r
+       static final String KEY_ENABLE_ALBUM_ART = "cbArt";\r
+       static final String KEY_ENABLE_SONG_TEXT = "tvLine1";\r
+       static final String KEY_ENABLE_ARTIST_TEXT = "tvLine2";\r
+       static final String KEY_ENABLE_ALBUM_TEXT = "tvLine3";\r
+       static final String KEY_COLOR_PREFERENCE_KEY = "color";\r
+       static final String KEY_ENABLE_STATUS_PLAY_BUTTON = "cbStatusPlay";\r
+       static final String KEY_ENABLE_SHARE_BUTTON = "cbShare";\r
+       static final String KEY_ENABLE_PROGRESS_BAR = "cbProgress";\r
+       static final String KEY_ENABLE_OVER_FLOW = "cbFlow";\r
+\r
+       static final String KEY_ENABLE_STATUS_NEXT_BUTTON = "cbStatusNext";\r
+       static final String KEY_ENABLE_STATUS_PREV_BUTTON = "cbStatusPrev";\r
+       static final String KEY_ENABLE_STATUS_ALBUM_ART = "cbStatusArt";\r
+       static final String KEY_ENABLE_STATUS_SONG_TEXT = "tvStatusLine1";\r
+       static final String KEY_ENABLE_STATUS_ARTIST_TEXT = "tvStatusLine2";\r
+       static final String KEY_ENABLE_STATUS_ALBUM_TEXT = "tvStatusLine3";\r
+       static final String KEY_ENABLE_MARKET_SERACH = "cbMarket";\r
+       static final String KEY_ENABLE_STATUS_COLLAPSE = "cbStatusCollapse";\r
+       static final String SCREENSAVER_COLOR = "screensaver_color";\r
+       static final String SCREENSAVER_COLOR_ALPHA = "screensaver_color_alpha";\r
+       static final String SCREENSAVER_COLOR_RED = "screensaver_color_red";\r
+       static final String SCREENSAVER_COLOR_GREEN = "screensaver_color_green";\r
+       static final String SCREENSAVER_COLOR_BLUE = "screensaver_color_blue";\r
+       static final String KEY_ENTER_FULL_NOW_PLAYING = "cbEnterNowPlaying";\r
+       static final String KEY_ENABLE_STATUS_TEXT_COLOR = "tvStatusColor";\r
+       static final String KEY_ENABLE_HOME_ART = "cbHomeAlbumArt";\r
+       static final String KEY_LOCK = "cbLock";\r
+       public static final String THEME_DEFAULT = "Music";\r
+       static final String THEME_KEY = "themePackageName";\r
+       static final String SHAKE_SENSITIVITY = "shake_sensitivity";\r
+       static final String FLIP_SENSITIVITY = "flip_sensitivity";\r
+\r
+       // This key has the gesture entry name (E.g. PAUSE) appended to it before\r
+       // use\r
+       static final String KEY_HAS_CUSTOM_GESTURE_XXX = "has_custom_gesture_";\r
+\r
+       static final String DEFAULT_DUCK_ATTENUATION_DB = "8";\r
+       static final String DEFAULT_BACK_BUTTON_ACTION_DB = "0";\r
+\r
+       static final String ACTION_ENABLE_GESTURES_CHANGED = "com.android.music.enablegestureschanged";\r
+       static final String ACTION_GESTURES_CHANGED = "com.android.music.gestureschanged";\r
+\r
+       static final String PREFERENCES_FILE = "settings";\r
+       public static final String KEY_ENABLE_STATUS_NONYA = "cbStatusNonya";\r
+       public static final String KEY_BUILD_VERSION = "build";\r
+       public static final String KEY_SOUND_EFFECT = "eqEffects";\r
+       public static final String KEY_FEEDBACK = "feedback";\r
+       public static final String KEY_FLIP = "cbFlip";\r
+       public static final String KEY_TICK = "cbStatusTicker";\r
+\r
+       long[] mHits = new long[3];\r
+       private static final String LOG_TAG = "EasterEgg";\r
+       private static final int EFFECTS_PANEL = 0;\r
+\r
+       // Color to use for text & graphics in screen saver mode.\r
+       static final int DEFAULT_SCREENSAVER_COLOR_ALPHA = 230;\r
+       static final int DEFAULT_SCREENSAVER_COLOR_RED = 0;\r
+       static final int DEFAULT_SCREENSAVER_COLOR_GREEN = 192;\r
+       static final int DEFAULT_SCREENSAVER_COLOR_BLUE = 255;\r
+       // Custom wallpaper\r
+       static final String BG_PHOTO_FILE = "home_art";\r
+       static final String TEMP_PHOTO_FILE = "home";\r
+       private Bitmap bgBitmap = null;\r
+       // Shake and Flip sensitivity\r
+       static final double DEFAULT_SHAKE_SENS = 2;\r
+       static final int DEFAULT_FLIP_SENS = 10;\r
+\r
+       public AlertDialog themeAlert;\r
+       public CheckBoxPreference cp;\r
+\r
+       @Override\r
+       protected void onCreate(Bundle savedInstanceState) {\r
+               super.onCreate(savedInstanceState);\r
+\r
+               PreferenceManager preferenceManager = getPreferenceManager();\r
+               preferenceManager.setSharedPreferencesName(PREFERENCES_FILE);\r
+               addPreferencesFromResource(R.xml.settings);\r
+\r
+               ActionBar bar = getActionBar();\r
+               bar.setDisplayHomeAsUpEnabled(true);\r
+\r
+               PreferenceScreen screen;\r
+               screen = getPreferenceScreen();\r
+\r
+               cp = (CheckBoxPreference) screen.findPreference("cbHomeAlbumArt");\r
+\r
+               final CheckBoxPreference lk = (CheckBoxPreference) screen\r
+                               .findPreference("cbLock");\r
+\r
+               AlertDialog.Builder builder = new AlertDialog.Builder(this);\r
+               builder.setTitle("Set Wallpaper");\r
+               builder.setIcon(android.R.drawable.ic_menu_crop);\r
+               builder.setMessage(\r
+                               "You should select a wallpaper to use when your music is paused.")\r
+                               .setCancelable(false)\r
+                               .setPositiveButton("Okay",\r
+                                               new DialogInterface.OnClickListener() {\r
+                                                       public void onClick(DialogInterface dialog, int id) {\r
+                                                               pickImage();\r
+                                                       }\r
+                                               })\r
+                               .setNegativeButton("Cancel",\r
+                                               new DialogInterface.OnClickListener() {\r
+                                                       public void onClick(DialogInterface dialog, int id) {\r
+                                                               dialog.cancel();\r
+                                                               cp.setChecked(false);\r
+                                                       }\r
+                                               });\r
+               final AlertDialog alert = builder.create();\r
+\r
+               AlertDialog.Builder lock = new AlertDialog.Builder(this);\r
+               lock.setTitle("Requires Restart");\r
+               lock.setIcon(R.drawable.ic_dialog_alert_holo_dark);\r
+               lock.setMessage(\r
+                               "Music needs to stop completely and restart to let the changes take effect")\r
+                               .setCancelable(false)\r
+                               .setPositiveButton("Okay",\r
+                                               new DialogInterface.OnClickListener() {\r
+                                                       public void onClick(DialogInterface dialog, int id) {\r
+                                                               // This isn't a good practice, but we need to\r
+                                                               // restart the\r
+                                                               // service completely to see the change\r
+                                                               // immediately\r
+                                                               System.exit(0);\r
+                                                       }\r
+                                               })\r
+                               .setNegativeButton("Cancel",\r
+                                               new DialogInterface.OnClickListener() {\r
+                                                       public void onClick(DialogInterface dialog, int id) {\r
+                                                               dialog.cancel();\r
+                                                               if (lk.isChecked()) {\r
+                                                                       lk.setChecked(false);\r
+                                                               } else {\r
+                                                                       lk.setChecked(true);\r
+                                                               }\r
+                                                       }\r
+                                               });\r
+               final AlertDialog lockAlert = lock.create();\r
+\r
+               cp.setOnPreferenceClickListener(new OnPreferenceClickListener() {\r
+                       public boolean onPreferenceClick(final Preference preference) {\r
+                               CheckBoxPreference cbp = (CheckBoxPreference) preference;\r
+                               if (cbp.isChecked()) {\r
+                                       alert.show();\r
+                               } else {\r
+                                       // We don't want the wall paper to remain the album art if\r
+                                       // they aren't using this.\r
+                                       setCustomBackground();\r
+                               }\r
+                               return true;\r
+                       }\r
+               });\r
+\r
+               lk.setOnPreferenceClickListener(new OnPreferenceClickListener() {\r
+                       public boolean onPreferenceClick(final Preference preference) {\r
+                               lockAlert.show();\r
+                               return true;\r
+                       }\r
+               });\r
+\r
+               try {\r
+                       PackageInfo packageInfo = getPackageManager().getPackageInfo(\r
+                                       getPackageName(), 0);\r
+                       findPreference(KEY_BUILD_VERSION).setSummary(\r
+                                       Build.VERSION.RELEASE + " - " + packageInfo.versionName);\r
+               } catch (NameNotFoundException e) {\r
+                       findPreference(KEY_BUILD_VERSION).setSummary("?");\r
+               }\r
+               // ADW: theme settings\r
+               SharedPreferences sp = getPreferenceManager().getSharedPreferences();\r
+               final String themePackage = sp.getString(THEME_KEY, THEME_DEFAULT);\r
+               ListPreference themeLp = (ListPreference) findPreference(THEME_KEY);\r
+               themeLp.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {\r
+                       public boolean onPreferenceChange(Preference preference,\r
+                                       Object newValue) {\r
+                               PreviewPreference themePreview = (PreviewPreference) findPreference("themePreview");\r
+                               themePreview.setTheme(newValue.toString());\r
+                               return false;\r
+                       }\r
+               });\r
+\r
+               Intent intent = new Intent("com.andrew.music.THEMES");\r
+               intent.addCategory("android.intent.category.DEFAULT");\r
+               PackageManager pm = getPackageManager();\r
+               List<ResolveInfo> themes = pm.queryIntentActivities(intent, 0);\r
+               String[] entries = new String[themes.size() + 1];\r
+               String[] values = new String[themes.size() + 1];\r
+               entries[0] = MusicSettingsActivity.THEME_DEFAULT;\r
+               values[0] = MusicSettingsActivity.THEME_DEFAULT;\r
+               for (int i = 0; i < themes.size(); i++) {\r
+                       String appPackageName = (themes.get(i)).activityInfo.packageName\r
+                                       .toString();\r
+                       String themeName = (themes.get(i)).loadLabel(pm).toString();\r
+                       entries[i + 1] = themeName;\r
+                       values[i + 1] = appPackageName;\r
+               }\r
+               themeLp.setEntries(entries);\r
+               themeLp.setEntryValues(values);\r
+               PreviewPreference themePreview = (PreviewPreference) findPreference("themePreview");\r
+               themePreview.setTheme(themePackage);\r
+       }\r
+\r
+       private void pickImage() {\r
+               Intent intent = new Intent(Intent.ACTION_GET_CONTENT);\r
+               intent.setType("image/*");\r
+\r
+               intent.putExtra("crop", "true");\r
+               intent.putExtra("scale", true);\r
+               intent.putExtra("outputFormat", Bitmap.CompressFormat.PNG.toString());\r
+               intent.putExtra(MediaStore.EXTRA_OUTPUT, getTempUri());\r
+               intent.putExtra("noFaceDetection", true);\r
+\r
+               startActivityForResult(intent, 0);\r
+       }\r
+\r
+       private Uri getTempUri() {\r
+               return Uri.fromFile(getTempFile());\r
+       }\r
+\r
+       private File getTempFile() {\r
+               if (isSDCARDMounted()) {\r
+\r
+                       File f = new File(Environment.getExternalStorageDirectory(),\r
+                                       TEMP_PHOTO_FILE);\r
+                       // try {\r
+                       // f.createNewFile();\r
+                       // } catch (IOException e) {\r
+                       // TODO Auto-generated catch block\r
+                       // e.printStackTrace();\r
+                       // Toast.makeText(this, "Something Fucked Up",\r
+                       // Toast.LENGTH_LONG).show();\r
+                       // }\r
+                       return f;\r
+               } else {\r
+                       return null;\r
+               }\r
+       }\r
+\r
+       private boolean isSDCARDMounted() {\r
+               String status = Environment.getExternalStorageState();\r
+\r
+               if (status.equals(Environment.MEDIA_MOUNTED))\r
+                       return true;\r
+               return false;\r
+       }\r
+\r
+       public static void copyFile(File src, File dst) throws IOException {\r
+               FileChannel inChannel = new FileInputStream(src).getChannel();\r
+               FileChannel outChannel = new FileOutputStream(dst).getChannel();\r
+\r
+               try {\r
+                       inChannel.transferTo(0, inChannel.size(), outChannel);\r
+               } finally {\r
+\r
+                       if (inChannel != null)\r
+                               inChannel.close();\r
+                       if (outChannel != null)\r
+                               outChannel.close();\r
+               }\r
+       }\r
+\r
+       protected void onActivityResult(int requestCode, int resultCode, Intent data) {\r
+               if (requestCode == 0) {\r
+                       if (resultCode == RESULT_OK) {\r
+                               try {\r
+\r
+                                       File src = getTempFile();\r
+                                       File dst = new File(getFilesDir(), BG_PHOTO_FILE);\r
+                                       copyFile(src, dst);\r
+\r
+                               } catch (FileNotFoundException e) {\r
+                                       // TODO Auto-generated catch block\r
+                                       e.printStackTrace();\r
+                               } catch (IOException e) {\r
+                                       // TODO Auto-generated catch block\r
+                                       e.printStackTrace();\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
+       // Set Custom Background Image\r
+       public void setCustomBackground() {\r
+\r
+               SharedPreferences preferences = getSharedPreferences(\r
+                               MusicSettingsActivity.PREFERENCES_FILE, MODE_PRIVATE);\r
+\r
+               preferences\r
+                               .getBoolean(MusicSettingsActivity.KEY_ENABLE_HOME_ART, false);\r
+\r
+               // First clean our old data\r
+               if (bgBitmap != null) {\r
+                       bgBitmap.recycle();\r
+                       bgBitmap = null;\r
+                       System.gc();\r
+               }\r
+               // now load the proper bg\r
+               String BG_FILE = getFilesDir().toString() + File.separator\r
+                               + MusicSettingsActivity.BG_PHOTO_FILE;\r
+               bgBitmap = BitmapFactory.decodeFile(BG_FILE);\r
+\r
+               try {\r
+                       WallpaperManager.getInstance(this).setBitmap(bgBitmap);\r
+               } catch (Exception e) {\r
+                       // TODO Auto-generated catch block\r
+                       e.printStackTrace();\r
+               }\r
+       }\r
+\r
+       public void applyTheme(View v) {\r
+               PreviewPreference themePreview = (PreviewPreference) findPreference("themePreview");\r
+               String packageName = themePreview.getValue().toString();\r
+               // this time we really save the themepackagename\r
+               SharedPreferences sp = getPreferenceManager().getSharedPreferences();\r
+               final SharedPreferences.Editor editor = sp.edit();\r
+               editor.putString("themePackageName", packageName);\r
+               // and update the preferences from the theme\r
+               // TODO:ADW maybe this should be optional for the user\r
+               if (!packageName.equals(MusicSettingsActivity.THEME_DEFAULT)) {\r
+                       Resources themeResources = null;\r
+                       try {\r
+                               themeResources = getPackageManager()\r
+                                               .getResourcesForApplication(packageName.toString());\r
+                       } catch (NameNotFoundException e) {\r
+                               // e.printStackTrace();\r
+                       }\r
+               } else {\r
+\r
+               }\r
+               AlertDialog.Builder theme = new AlertDialog.Builder(this);\r
+               theme.setTitle("Requires Restart");\r
+               theme.setIcon(R.drawable.ic_dialog_alert_holo_dark);\r
+               theme.setMessage(\r
+                               "Music needs to stop completely and restart to let the changes take effect")\r
+                               .setCancelable(false)\r
+                               .setPositiveButton("Okay",\r
+                                               new DialogInterface.OnClickListener() {\r
+                                                       public void onClick(DialogInterface dialog, int id) {\r
+                                                               editor.commit();\r
+                                                               // This isn't a good practice, but we need to\r
+                                                               // restart the\r
+                                                               // service completely to see the change\r
+                                                               // immediately\r
+                                                               System.exit(0);\r
+                                                       }\r
+                                               })\r
+                               .setNegativeButton("Cancel",\r
+                                               new DialogInterface.OnClickListener() {\r
+                                                       public void onClick(DialogInterface dialog, int id) {\r
+                                                               dialog.cancel();\r
+                                                       }\r
+                                               });\r
+               themeAlert = theme.create();\r
+               themeAlert.show();\r
+       }\r
+\r
+       public void getThemes(View v) {\r
+               // TODO:warn theme devs to use "MusicTheme" as keyword.\r
+               Uri marketUri = Uri.parse("market://search?q=MusicTheme");\r
+               Intent marketIntent = new Intent(Intent.ACTION_VIEW).setData(marketUri);\r
+               try {\r
+                       startActivity(marketIntent);\r
+               } catch (ActivityNotFoundException e) {\r
+                       Toast.makeText(this, R.string.activity_not_found,\r
+                                       Toast.LENGTH_SHORT).show();\r
+               } catch (SecurityException e) {\r
+                       Toast.makeText(this, R.string.activity_not_found,\r
+                                       Toast.LENGTH_SHORT).show();\r
+                       Log.e("Music", "Get themes", e);\r
+               }\r
+               finish();\r
+       }\r
+\r
+       @Override\r
+       public boolean onOptionsItemSelected(MenuItem item) {\r
+               switch (item.getItemId()) {\r
+               case android.R.id.home:\r
+                       super.onBackPressed();\r
+                       break;\r
+               }\r
+               return super.onOptionsItemSelected(item);\r
+       }\r
+\r
+       @Override\r
+       public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,\r
+                       String key) {\r
+               if (key.equals(KEY_ENABLE_GESTURES)) {\r
+                       Intent intent = new Intent(ACTION_ENABLE_GESTURES_CHANGED);\r
+                       sendBroadcast(intent);\r
+               }\r
+       }\r
+\r
+       @Override\r
+       protected void onResume() {\r
+               super.onResume();\r
+               getPreferenceScreen().getSharedPreferences()\r
+                               .registerOnSharedPreferenceChangeListener(this);\r
+       }\r
+\r
+       @Override\r
+       protected void onPause() {\r
+               super.onPause();\r
+               getPreferenceScreen().getSharedPreferences()\r
+                               .unregisterOnSharedPreferenceChangeListener(this);\r
+       }\r
+\r
+       @Override\r
+       protected void onDestroy() {\r
+               super.onDestroy();\r
+\r
+       }\r
+\r
+       @Override\r
+       public boolean onPreferenceChange(Preference arg0, Object arg1) {\r
+               // TODO Auto-generated method stub\r
+               return false;\r
+       }\r
+\r
+       @Override\r
+       public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,\r
+                       Preference preference) {\r
+               try {\r
+                       if (preference.getKey().equals(KEY_BUILD_VERSION)) {\r
+                               System.arraycopy(mHits, 1, mHits, 0, mHits.length - 1);\r
+                               mHits[mHits.length - 1] = SystemClock.uptimeMillis();\r
+                               if (mHits[0] >= (SystemClock.uptimeMillis() - 500)) {\r
+                                       Toast ImageToast = new Toast(getBaseContext());\r
+                                       LinearLayout toastLayout = new LinearLayout(\r
+                                                       getBaseContext());\r
+                                       toastLayout.setOrientation(LinearLayout.HORIZONTAL);\r
+                                       ImageView image = new ImageView(getBaseContext());\r
+                                       image.setImageResource(R.drawable.easter_egg);\r
+                                       toastLayout.addView(image);\r
+                                       ImageToast.setView(toastLayout);\r
+                                       ImageToast.setDuration(Toast.LENGTH_SHORT);\r
+                                       ImageToast.show();\r
+                               }\r
+                       }\r
+               } catch (NullPointerException ee) {\r
+\r
+               }\r
+               try {\r
+                       if (preference.getKey().equals(KEY_SOUND_EFFECT)) {\r
+                               Intent i = new Intent(\r
+                                               AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);\r
+                               try {\r
+                                       i.putExtra(AudioEffect.EXTRA_AUDIO_SESSION,\r
+                                                       MusicUtils.sService.getAudioSessionId());\r
+                               } catch (Exception e) {\r
+                                       // TODO Auto-generated catch block\r
+                                       e.printStackTrace();\r
+                               }\r
+                               startActivityForResult(i, EFFECTS_PANEL);\r
+                       }\r
+               } catch (NullPointerException ee) {\r
+\r
+               }\r
+\r
+               return super.onPreferenceTreeClick(preferenceScreen, preference);\r
+       }\r
+}\r
index 2ad1424..e8895aa 100644 (file)
@@ -1,40 +1,40 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-package com.android.music;
-
-import android.content.Context;
-import android.support.v4.view.ViewPager;
-import android.util.AttributeSet;
-
-public class MusicViewPager extends ViewPager {
-       public MusicViewPager(Context context) {
-               super(context);
-       }
-
-       public MusicViewPager(Context context, AttributeSet attrs) {
-               super(context, attrs);
-       }
-
-       /**
-        * ViewPager inherits ViewGroup's default behavior of delayed clicks on its
-        * children, but in order to make the calc buttons more responsive we
-        * disable that here.
-        */
-       public boolean shouldDelayChildPressedState() {
-               return false;
-       }
-}
+/*\r
+ * Copyright (C) 2011 The Android Open Source Project\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package com.android.music;\r
+\r
+import android.content.Context;\r
+import android.support.v4.view.ViewPager;\r
+import android.util.AttributeSet;\r
+\r
+public class MusicViewPager extends ViewPager {\r
+       public MusicViewPager(Context context) {\r
+               super(context);\r
+       }\r
+\r
+       public MusicViewPager(Context context, AttributeSet attrs) {\r
+               super(context, attrs);\r
+       }\r
+\r
+       /**\r
+        * ViewPager inherits ViewGroup's default behavior of delayed clicks on its\r
+        * children, but in order to make the calc buttons more responsive we\r
+        * disable that here.\r
+        */\r
+       public boolean shouldDelayChildPressedState() {\r
+               return false;\r
+       }\r
+}\r
index 6764f8f..10eeaa1 100644 (file)
@@ -311,16 +311,10 @@ public class PlaylistBrowserActivity extends ListActivity implements
                        mButtonBarSong = (TextView) findViewById(R.id.songtab);
                        mButtonBarPlaylist = (TextView) findViewById(R.id.playlisttab);
                        mButtonBarNP = (TextView) findViewById(R.id.nowplayingtab);
-                       mGroup = (RelativeLayout) findViewById(R.id.group_item);
-                       mChild = (RelativeLayout) findViewById(R.id.child_item);
                        ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
                                        themePackage, "tab_playlist", mPlaylistTab,
                                        THEME_ITEM_BACKGROUND);
                        ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
-                                       themePackage, "group_bg", mGroup, THEME_ITEM_BACKGROUND);
-                       ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
-                                       themePackage, "child_bg", mChild, THEME_ITEM_BACKGROUND);
-                       ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
                                        themePackage, "buttonbar", mButtonBar,
                                        THEME_ITEM_BACKGROUND);
                        ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
@@ -1127,22 +1121,7 @@ public class PlaylistBrowserActivity extends ListActivity implements
                        long id = cursor.getLong(mIdIdx);
 
                        ImageView iv = (ImageView) view.findViewById(R.id.icon);
-                       if (id == RECENTLY_ADDED_PLAYLIST) {
-                               iv.setImageResource(R.drawable.ic_mp_playlist_recently_added_list);
-                               if (themeResources != null) {
-                                       ArtistAlbumBrowserActivity.loadThemeResource(
-                                                       themeResources, themePackage,
-                                                       "playlist_recently_added", iv,
-                                                       THEME_ITEM_FOREGROUND);
-                               }
-                       } else {
-                               iv.setImageResource(R.drawable.ic_mp_playlist_list);
-                               if (themeResources != null) {
-                                       ArtistAlbumBrowserActivity.loadThemeResource(
-                                                       themeResources, themePackage, "playlist_list", iv,
-                                                       THEME_ITEM_FOREGROUND);
-                               }
-                       }
+
                        ViewGroup.LayoutParams p = iv.getLayoutParams();
                        p.width = ViewGroup.LayoutParams.WRAP_CONTENT;
                        p.height = ViewGroup.LayoutParams.WRAP_CONTENT;
@@ -1156,6 +1135,7 @@ public class PlaylistBrowserActivity extends ListActivity implements
                                        .findViewById(R.id.second_column_icon);
                        iv.setVisibility(View.GONE);
                        mContextMenu.setOnClickListener(mCML);
+                       ImageView cM = (ImageView) view.findViewById(R.id.CM);
                        if (themeResources != null) {
 
                                int line1 = themeResources.getIdentifier(
@@ -1164,6 +1144,9 @@ public class PlaylistBrowserActivity extends ListActivity implements
                                if (line1 != 0) {
                                        tv.setTextColor(themeResources.getColor(line1));
                                }
+                               ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
+                                               themePackage, "bt_context_menu", cM,
+                                               THEME_ITEM_FOREGROUND);
                        }
                }
 
@@ -1233,12 +1216,13 @@ public class PlaylistBrowserActivity extends ListActivity implements
                try {
                        if (mService != null && mService.isPlaying()) {
                                mPlay.setImageResource(R.drawable.ic_media_pause);
-                               ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
-                                               themePackage, "np_pause", mPlay, THEME_ITEM_FOREGROUND);
+                               ArtistAlbumBrowserActivity
+                                               .loadThemeResource(themeResources, themePackage,
+                                                               "snp_pause", mPlay, THEME_ITEM_FOREGROUND);
                        } else {
                                mPlay.setImageResource(R.drawable.ic_appwidget_music_play);
                                ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
-                                               themePackage, "np_play", mPlay, THEME_ITEM_FOREGROUND);
+                                               themePackage, "snp_play", mPlay, THEME_ITEM_FOREGROUND);
                        }
                } catch (RemoteException ex) {
                }
index 8113fc6..eca85af 100644 (file)
-package com.android.music;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.content.DialogInterface;
-import android.content.SharedPreferences;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.widget.ImageView;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class Sensitivity extends Activity implements
-               SeekBar.OnSeekBarChangeListener {
-
-       private int shakeChange;
-       private int flipChange;
-       private int bool;
-
-       SeekBar shake;
-       SeekBar flip;
-       TextView mProgressText;
-       ImageView mFlip;
-       ImageView mShake;
-
-       SharedPreferences mPrefs;
-
-       AlertDialog alert;
-
-       @Override
-       protected void onCreate(Bundle savedInstanceState) {
-               // TODO Auto-generated method stub
-               super.onCreate(savedInstanceState);
-               setContentView(R.layout.sensitive);
-
-               mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
-               loadPreferences();
-
-               shake = (SeekBar) findViewById(R.id.shake_sens);
-               flip = (SeekBar) findViewById(R.id.flip_sens);
-               mShake = (ImageView) findViewById(R.id.iv_shake_sens);
-               mFlip = (ImageView) findViewById(R.id.iv_flip_sens);
-
-               mShake.setImageResource(R.drawable.ic_shake);
-               mFlip.setImageResource(R.drawable.ic_flip);
-
-               shake.setOnSeekBarChangeListener(this);
-               flip.setOnSeekBarChangeListener(this);
-               shake.setProgress(shakeChange);
-               flip.setProgress(flipChange);
-
-               AlertDialog.Builder builder = new AlertDialog.Builder(this);
-               builder.setTitle("Restart Required");
-               builder.setIcon(R.drawable.ic_dialog_alert_holo_dark);
-               builder.setMessage(
-                               "Music will restart after you make your changes to use them immeditately.")
-                               .setCancelable(false)
-                               .setPositiveButton("Okay",
-                                               new DialogInterface.OnClickListener() {
-                                                       public void onClick(DialogInterface dialog, int id) {
-
-                                                       }
-                                               });
-               alert = builder.create();
-               alert.show();
-       }
-
-       @Override
-       public void onStop() {
-               super.onStop();
-               saveSens();
-               System.exit(0);
-
-       }
-
-       private void saveSens() {
-               SharedPreferences.Editor editor = mPrefs.edit();
-               editor.putInt(MusicSettingsActivity.SHAKE_SENSITIVITY, shakeChange);
-               editor.putInt(MusicSettingsActivity.FLIP_SENSITIVITY, flipChange);
-               editor.commit();
-       }
-
-       private void loadPreferences() {
-               shakeChange = new Integer(mPrefs.getInt(
-                               MusicSettingsActivity.SHAKE_SENSITIVITY,
-                               (int) (MusicSettingsActivity.DEFAULT_SHAKE_SENS)));
-               flipChange = new Integer(mPrefs.getInt(
-                               MusicSettingsActivity.FLIP_SENSITIVITY,
-                               MusicSettingsActivity.DEFAULT_FLIP_SENS));
-       }
-
-       public void onProgressChanged(SeekBar seekBar, int progress,
-                       boolean fromUser) {
-               if (seekBar == shake)
-                       shakeChange = progress;
-               else if (seekBar == flip)
-                       flipChange = progress;
-
-       }
-
-       @Override
-       public void onStartTrackingTouch(SeekBar seekBar) {
-               // TODO Auto-generated method stub
-
-       }
-
-       @Override
-       public void onStopTrackingTouch(SeekBar seekBar) {
-               // TODO Auto-generated method stub
-
-       }
-
-}
+package com.android.music;\r
+\r
+import android.app.Activity;\r
+import android.app.AlertDialog;\r
+import android.content.DialogInterface;\r
+import android.content.SharedPreferences;\r
+import android.os.Bundle;\r
+import android.preference.PreferenceManager;\r
+import android.widget.ImageView;\r
+import android.widget.SeekBar;\r
+import android.widget.TextView;\r
+\r
+public class Sensitivity extends Activity implements\r
+               SeekBar.OnSeekBarChangeListener {\r
+\r
+       private int shakeChange;\r
+       private int flipChange;\r
+       private int bool;\r
+\r
+       SeekBar shake;\r
+       SeekBar flip;\r
+       TextView mProgressText;\r
+       ImageView mFlip;\r
+       ImageView mShake;\r
+\r
+       SharedPreferences mPrefs;\r
+\r
+       AlertDialog alert;\r
+\r
+       @Override\r
+       protected void onCreate(Bundle savedInstanceState) {\r
+               // TODO Auto-generated method stub\r
+               super.onCreate(savedInstanceState);\r
+               setContentView(R.layout.sensitive);\r
+\r
+               mPrefs = PreferenceManager.getDefaultSharedPreferences(this);\r
+               loadPreferences();\r
+\r
+               shake = (SeekBar) findViewById(R.id.shake_sens);\r
+               flip = (SeekBar) findViewById(R.id.flip_sens);\r
+               mShake = (ImageView) findViewById(R.id.iv_shake_sens);\r
+               mFlip = (ImageView) findViewById(R.id.iv_flip_sens);\r
+\r
+               mShake.setImageResource(R.drawable.ic_shake);\r
+               mFlip.setImageResource(R.drawable.ic_flip);\r
+\r
+               shake.setOnSeekBarChangeListener(this);\r
+               flip.setOnSeekBarChangeListener(this);\r
+               shake.setProgress(shakeChange);\r
+               flip.setProgress(flipChange);\r
+\r
+               AlertDialog.Builder builder = new AlertDialog.Builder(this);\r
+               builder.setTitle("Restart Required");\r
+               builder.setIcon(R.drawable.ic_dialog_alert_holo_dark);\r
+               builder.setMessage(\r
+                               "Music will restart after you make your changes to use them immeditately.")\r
+                               .setCancelable(false)\r
+                               .setPositiveButton("Okay",\r
+                                               new DialogInterface.OnClickListener() {\r
+                                                       public void onClick(DialogInterface dialog, int id) {\r
+\r
+                                                       }\r
+                                               });\r
+               alert = builder.create();\r
+               alert.show();\r
+       }\r
+\r
+       @Override\r
+       public void onStop() {\r
+               super.onStop();\r
+               saveSens();\r
+               System.exit(0);\r
+\r
+       }\r
+\r
+       private void saveSens() {\r
+               SharedPreferences.Editor editor = mPrefs.edit();\r
+               editor.putInt(MusicSettingsActivity.SHAKE_SENSITIVITY, shakeChange);\r
+               editor.putInt(MusicSettingsActivity.FLIP_SENSITIVITY, flipChange);\r
+               editor.commit();\r
+       }\r
+\r
+       private void loadPreferences() {\r
+               shakeChange = new Integer(mPrefs.getInt(\r
+                               MusicSettingsActivity.SHAKE_SENSITIVITY,\r
+                               (int) (MusicSettingsActivity.DEFAULT_SHAKE_SENS)));\r
+               flipChange = new Integer(mPrefs.getInt(\r
+                               MusicSettingsActivity.FLIP_SENSITIVITY,\r
+                               MusicSettingsActivity.DEFAULT_FLIP_SENS));\r
+       }\r
+\r
+       public void onProgressChanged(SeekBar seekBar, int progress,\r
+                       boolean fromUser) {\r
+               if (seekBar == shake)\r
+                       shakeChange = progress;\r
+               else if (seekBar == flip)\r
+                       flipChange = progress;\r
+\r
+       }\r
+\r
+       @Override\r
+       public void onStartTrackingTouch(SeekBar seekBar) {\r
+               // TODO Auto-generated method stub\r
+\r
+       }\r
+\r
+       @Override\r
+       public void onStopTrackingTouch(SeekBar seekBar) {\r
+               // TODO Auto-generated method stub\r
+\r
+       }\r
+\r
+}\r
index de72fcd..1805ae8 100644 (file)
@@ -1,89 +1,91 @@
-package com.android.music;
-
-import android.content.Context;
-import android.hardware.Sensor;
-import android.hardware.SensorEvent;
-import android.hardware.SensorEventListener;
-import android.hardware.SensorManager;
-import android.os.SystemClock;
-import com.android.music.R;
-
-public class Shaker {
-       private SensorManager mgr = null;
-       private long lastShakeTimestamp = 0;
-       private double threshold = 1.0d;
-       private long gap = 0;
-       private Shaker.Callback cb = null;
-
-       public Shaker(Context ctxt, double threshold, long gap, Shaker.Callback cb) {
-               this.threshold = threshold * threshold;
-               this.threshold = this.threshold * SensorManager.GRAVITY_EARTH
-                               * SensorManager.GRAVITY_EARTH;
-               this.gap = gap;
-               this.cb = cb;
-
-               mgr = (SensorManager) ctxt.getSystemService(Context.SENSOR_SERVICE);
-               mgr.registerListener(listener,
-                               mgr.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
-                               SensorManager.SENSOR_DELAY_UI);
-       }
-
-       public void close() {
-               mgr.unregisterListener(listener);
-       }
-
-       private void isShaking() {
-               long now = SystemClock.uptimeMillis();
-
-               if (lastShakeTimestamp == 0) {
-                       lastShakeTimestamp = now;
-
-                       if (cb != null) {
-                               cb.shakingStarted();
-                       }
-               } else {
-                       lastShakeTimestamp = now;
-               }
-       }
-
-       private void isNotShaking() {
-               long now = SystemClock.uptimeMillis();
-
-               if (lastShakeTimestamp > 0) {
-                       if (now - lastShakeTimestamp > gap) {
-                               lastShakeTimestamp = 0;
-
-                               if (cb != null) {
-                                       cb.shakingStopped();
-                               }
-                       }
-               }
-       }
-
-       public interface Callback {
-               void shakingStarted();
-
-               void shakingStopped();
-       }
-
-       private SensorEventListener listener = new SensorEventListener() {
-               public void onSensorChanged(SensorEvent e) {
-                       if (e.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
-                               double netForce = e.values[0] * e.values[0];
-
-                               netForce += e.values[1] * e.values[1];
-                               netForce += e.values[2] * e.values[2];
-
-                               if (threshold < netForce) {
-                                       isShaking();
-                               } else {
-                                       isNotShaking();
-                               }
-                       }
-               }
-
-               public void onAccuracyChanged(Sensor sensor, int accuracy) {
-                       // unused
-               }
-       };
+package com.android.music;\r
+\r
+import android.content.Context;\r
+import android.hardware.Sensor;\r
+import android.hardware.SensorEvent;\r
+import android.hardware.SensorEventListener;\r
+import android.hardware.SensorManager;\r
+import android.os.SystemClock;\r
+\r
+public class Shaker {\r
+       private SensorManager mgr = null;\r
+       private long lastShakeTimestamp = 0;\r
+       private double threshold = 1.0d;\r
+       private long gap = 0;\r
+       private Shaker.Callback cb = null;\r
+\r
+       public Shaker(Context ctxt, double threshold, long gap, Shaker.Callback cb) {\r
+               this.threshold = threshold * threshold;\r
+               this.threshold = this.threshold * SensorManager.GRAVITY_EARTH\r
+                               * SensorManager.GRAVITY_EARTH;\r
+               this.gap = gap;\r
+               this.cb = cb;\r
+\r
+               mgr = (SensorManager) ctxt.getSystemService(Context.SENSOR_SERVICE);\r
+               mgr.registerListener(listener,\r
+                               mgr.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),\r
+                               SensorManager.SENSOR_DELAY_UI);\r
+       }\r
+\r
+       public void close() {\r
+               mgr.unregisterListener(listener);\r
+       }\r
+\r
+       private void isShaking() {\r
+               long now = SystemClock.uptimeMillis();\r
+               try {\r
+                       if (lastShakeTimestamp == 0) {\r
+                               lastShakeTimestamp = now;\r
+\r
+                               if (cb != null) {\r
+                                       cb.shakingStarted();\r
+                               }\r
+                       } else {\r
+                               lastShakeTimestamp = now;\r
+                       }\r
+               } catch (NullPointerException e) {\r
+\r
+               }\r
+       }\r
+\r
+       private void isNotShaking() {\r
+               long now = SystemClock.uptimeMillis();\r
+\r
+               if (lastShakeTimestamp > 0) {\r
+                       if (now - lastShakeTimestamp > gap) {\r
+                               lastShakeTimestamp = 0;\r
+\r
+                               if (cb != null) {\r
+                                       cb.shakingStopped();\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
+       public interface Callback {\r
+               void shakingStarted();\r
+\r
+               void shakingStopped();\r
+       }\r
+\r
+       private SensorEventListener listener = new SensorEventListener() {\r
+               public void onSensorChanged(SensorEvent e) {\r
+                       if (e.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {\r
+                               double netForce = e.values[0] * e.values[0];\r
+\r
+                               netForce += e.values[1] * e.values[1];\r
+                               netForce += e.values[2] * e.values[2];\r
+\r
+                               if (threshold < netForce) {\r
+                                       isShaking();\r
+                               } else {\r
+                                       isNotShaking();\r
+                               }\r
+                       }\r
+               }\r
+\r
+               public void onAccuracyChanged(Sensor sensor, int accuracy) {\r
+                       // unused\r
+               }\r
+       };\r
 }
\ No newline at end of file
index 8354487..2cf1705 100644 (file)
@@ -235,6 +235,30 @@ public class TrackBrowserActivity extends ListActivity implements
                        ((TouchInterceptor) mTrackList).setRemoveListener(mRemoveListener);
                        mTrackList.setDivider(null);
                        mTrackList.setSelector(R.drawable.list_selector_background);
+                       // ADW: Load the specified theme
+                       String themePackage = MusicUtils.getThemePackageName(this,
+                                       MusicSettingsActivity.THEME_DEFAULT);
+                       PackageManager pm = getPackageManager();
+                       Resources themeResources = null;
+                       if (!themePackage.equals(MusicSettingsActivity.THEME_DEFAULT)) {
+                               try {
+                                       themeResources = pm
+                                                       .getResourcesForApplication(themePackage);
+                               } catch (NameNotFoundException e) {
+                                       // ADW The saved theme was uninstalled so we save the
+                                       // default one
+                                       MusicUtils.setThemePackageName(this,
+                                                       MusicSettingsActivity.THEME_DEFAULT);
+                               }
+                       }
+                       // Set Views for themes
+                       if (themeResources != null) {
+                               int lS = themeResources.getIdentifier("queue_selector",
+                                               "drawable", themePackage);
+                               if (lS != 0) {
+                                       mTrackList.setSelector(themeResources.getDrawable(lS));
+                               }
+                       }
                } else {
                        mTrackList.setTextFilterEnabled(true);
                }
@@ -323,15 +347,9 @@ public class TrackBrowserActivity extends ListActivity implements
                        mButtonBarSong = (TextView) findViewById(R.id.songtab);
                        mButtonBarPlaylist = (TextView) findViewById(R.id.playlisttab);
                        mButtonBarNP = (TextView) findViewById(R.id.nowplayingtab);
-                       mGroup = (RelativeLayout) findViewById(R.id.group_item);
-                       mChild = (RelativeLayout) findViewById(R.id.child_item);
                        ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
                                        themePackage, "tab_song", mSongTab, THEME_ITEM_BACKGROUND);
                        ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
-                                       themePackage, "group_bg", mGroup, THEME_ITEM_BACKGROUND);
-                       ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
-                                       themePackage, "child_bg", mChild, THEME_ITEM_BACKGROUND);
-                       ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
                                        themePackage, "buttonbar", mButtonBar,
                                        THEME_ITEM_BACKGROUND);
                        ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
@@ -2072,12 +2090,31 @@ public class TrackBrowserActivity extends ListActivity implements
                                if (duration != 0) {
                                        vh.duration.setTextColor(themeResources.getColor(duration));
                                }
+                               ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
+                                               themePackage, "bt_context_menu", vh.mCM,
+                                               THEME_ITEM_FOREGROUND);
                        }
                        return v;
                }
 
                @Override
                public void bindView(View view, Context context, Cursor cursor) {
+                       // ADW: Load the specified theme
+                       String themePackage = MusicUtils.getThemePackageName(context,
+                                       MusicSettingsActivity.THEME_DEFAULT);
+                       PackageManager pm = context.getPackageManager();
+                       Resources themeResources = null;
+                       if (!themePackage.equals(MusicSettingsActivity.THEME_DEFAULT)) {
+                               try {
+                                       themeResources = pm
+                                                       .getResourcesForApplication(themePackage);
+                               } catch (NameNotFoundException e) {
+                                       // ADW The saved theme was uninstalled so we save the
+                                       // default one
+                                       MusicUtils.setThemePackageName(context,
+                                                       MusicSettingsActivity.THEME_DEFAULT);
+                               }
+                       }
 
                        ViewHolder vh = (ViewHolder) view.getTag();
 
@@ -2144,10 +2181,17 @@ public class TrackBrowserActivity extends ListActivity implements
                                iv.setBackgroundResource(R.anim.peak_meter);
                                AnimationDrawable frameAnimation = (AnimationDrawable) iv
                                                .getBackground();
-
+                               if (themeResources != null) {
+                                       int peak = themeResources.getIdentifier("peak_meter",
+                                                       "anim", themePackage);
+                                       if (peak != 0) {
+                                               iv.setBackgroundDrawable(themeResources
+                                                               .getDrawable(peak));
+                                               frameAnimation.start();
+                                       }
+                               }
                                // Start the animation (looped playback by default).
                                frameAnimation.start();
-
                                iv.setVisibility(View.VISIBLE);
                        } else {
                                iv.setVisibility(View.GONE);
@@ -2239,12 +2283,13 @@ public class TrackBrowserActivity extends ListActivity implements
                try {
                        if (mService != null && mService.isPlaying()) {
                                mPlay.setImageResource(R.drawable.ic_media_pause);
-                               ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
-                                               themePackage, "np_pause", mPlay, THEME_ITEM_FOREGROUND);
+                               ArtistAlbumBrowserActivity
+                                               .loadThemeResource(themeResources, themePackage,
+                                                               "snp_pause", mPlay, THEME_ITEM_FOREGROUND);
                        } else {
                                mPlay.setImageResource(R.drawable.ic_appwidget_music_play);
                                ArtistAlbumBrowserActivity.loadThemeResource(themeResources,
-                                               themePackage, "np_play", mPlay, THEME_ITEM_FOREGROUND);
+                                               themePackage, "snp_play", mPlay, THEME_ITEM_FOREGROUND);
                        }
                } catch (RemoteException ex) {
                }