aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-07-12 13:23:50 -0700
committerScott Jackson <daneren2005@gmail.com>2014-07-12 13:23:50 -0700
commit1bce73fa27683972021150de93ca7a5b66652e79 (patch)
tree8c31fbc39e909a11c67fd98a37a18f72aaebe682
parent5abe274a3572e08149fa10481bf552ab4ceda9c0 (diff)
parent9ac927c4c812149802fccdeb42dd66573c2c5281 (diff)
downloaddsub-1bce73fa27683972021150de93ca7a5b66652e79.tar.gz
dsub-1bce73fa27683972021150de93ca7a5b66652e79.tar.bz2
dsub-1bce73fa27683972021150de93ca7a5b66652e79.zip
Merge branch 'master' of https://github.com/daneren2005/Subsonic into MediaStore
-rw-r--r--AndroidManifest.xml4
-rw-r--r--res/drawable-hdpi/menubar_button_selected.9.pngbin302 -> 0 bytes
-rw-r--r--res/drawable/actionbar_button.xml18
-rw-r--r--res/drawable/btn_bg.xml17
-rw-r--r--res/drawable/media_button.xml9
-rw-r--r--res/drawable/menubar_button.xml14
-rw-r--r--res/drawable/menubar_button_normal.xml4
-rw-r--r--res/drawable/menubar_button_pressed.xml4
-rw-r--r--res/layout/abstract_fragment_activity.xml2
-rw-r--r--res/layout/album_cell_item.xml2
-rw-r--r--res/layout/album_list_item.xml2
-rw-r--r--res/layout/appwidget4x1.xml8
-rw-r--r--res/layout/appwidget4x2.xml8
-rw-r--r--res/layout/appwidget4x3.xml8
-rw-r--r--res/layout/appwidget4x4.xml8
-rw-r--r--res/layout/basic_list_item.xml2
-rw-r--r--res/layout/complex_list_item.xml2
-rw-r--r--res/layout/notification.xml6
-rw-r--r--res/layout/notification_expanded.xml13
-rw-r--r--res/layout/select_album_header.xml2
-rw-r--r--res/layout/song_list_item.xml2
-rw-r--r--res/layout/user_list_item.xml2
-rw-r--r--res/values/strings.xml4
-rw-r--r--res/values/styles.xml8
-rw-r--r--res/xml/changelog.xml10
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicActivity.java5
-rw-r--r--src/github/daneren2005/dsub/domain/MusicDirectory.java37
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java59
-rw-r--r--src/github/daneren2005/dsub/service/DownloadService.java30
-rw-r--r--src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java4
-rw-r--r--src/github/daneren2005/dsub/service/OfflineMusicService.java2
-rw-r--r--src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java4
-rw-r--r--src/github/daneren2005/dsub/util/Notifications.java23
-rw-r--r--src/github/daneren2005/dsub/view/SongView.java5
34 files changed, 166 insertions, 162 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 0eb73517..758c4e24 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="github.daneren2005.dsub"
android:installLocation="internalOnly"
- android:versionCode="114"
- android:versionName="4.7.1">
+ android:versionCode="115"
+ android:versionName="4.7.2">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
diff --git a/res/drawable-hdpi/menubar_button_selected.9.png b/res/drawable-hdpi/menubar_button_selected.9.png
deleted file mode 100644
index d47bec40..00000000
--- a/res/drawable-hdpi/menubar_button_selected.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/actionbar_button.xml b/res/drawable/actionbar_button.xml
deleted file mode 100644
index 5445cdcb..00000000
--- a/res/drawable/actionbar_button.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item
- android:state_pressed="true"
- android:drawable="@drawable/menubar_button_pressed"
- />
-
- <item
- android:state_focused="true"
- android:drawable="@drawable/menubar_button_pressed"
- />
-
- <item
- android:drawable="@drawable/actionbar_button_normal"
- />
-
-</selector> \ No newline at end of file
diff --git a/res/drawable/btn_bg.xml b/res/drawable/btn_bg.xml
deleted file mode 100644
index 79d40784..00000000
--- a/res/drawable/btn_bg.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?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"/>
-
-</selector> \ No newline at end of file
diff --git a/res/drawable/media_button.xml b/res/drawable/media_button.xml
deleted file mode 100644
index f144393d..00000000
--- a/res/drawable/media_button.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:state_pressed="true"
- android:drawable="@drawable/menubar_button_pressed"/>
-
- <item android:drawable="@drawable/menubar_button_normal"/>
-
-</selector> \ No newline at end of file
diff --git a/res/drawable/menubar_button.xml b/res/drawable/menubar_button.xml
deleted file mode 100644
index 1dc79176..00000000
--- a/res/drawable/menubar_button.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- 
- <item android:state_pressed="true"
- android:drawable="@drawable/menubar_button_pressed"/>
-
- <item android:state_enabled="true"
- android:drawable="@drawable/menubar_button_normal"/>
-
- <item android:drawable="@drawable/menubar_button_selected"/>
-
-</selector>
-
- \ No newline at end of file
diff --git a/res/drawable/menubar_button_normal.xml b/res/drawable/menubar_button_normal.xml
deleted file mode 100644
index 76589c0c..00000000
--- a/res/drawable/menubar_button_normal.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android">
- <solid android:color="@android:color/transparent" />
-</shape>
diff --git a/res/drawable/menubar_button_pressed.xml b/res/drawable/menubar_button_pressed.xml
deleted file mode 100644
index b7b42ee5..00000000
--- a/res/drawable/menubar_button_pressed.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android">
- <solid android:color="@color/dividerColor" />
-</shape>
diff --git a/res/layout/abstract_fragment_activity.xml b/res/layout/abstract_fragment_activity.xml
index 605b988a..5f3a592b 100644
--- a/res/layout/abstract_fragment_activity.xml
+++ b/res/layout/abstract_fragment_activity.xml
@@ -15,7 +15,7 @@
android:id="@+id/bottom_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:background="@drawable/media_button"
+ android:background="?android:selectableItemBackground"
android:orientation="horizontal">
<ImageView
diff --git a/res/layout/album_cell_item.xml b/res/layout/album_cell_item.xml
index 46024772..13fe9466 100644
--- a/res/layout/album_cell_item.xml
+++ b/res/layout/album_cell_item.xml
@@ -68,7 +68,7 @@
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:paddingRight="2dp"
- android:background="@drawable/menubar_button"/>
+ android:background="?android:selectableItemBackground"/>
</LinearLayout>
</LinearLayout> \ No newline at end of file
diff --git a/res/layout/album_list_item.xml b/res/layout/album_list_item.xml
index a98f0e04..805c9033 100644
--- a/res/layout/album_list_item.xml
+++ b/res/layout/album_list_item.xml
@@ -54,5 +54,5 @@
android:layout_height="fill_parent"
android:layout_gravity="right|center_vertical"
android:paddingRight="10dip"
- android:background="@drawable/menubar_button"/>
+ android:background="?android:selectableItemBackground"/>
</LinearLayout>
diff --git a/res/layout/appwidget4x1.xml b/res/layout/appwidget4x1.xml
index 45ab7886..5d75c9e9 100644
--- a/res/layout/appwidget4x1.xml
+++ b/res/layout/appwidget4x1.xml
@@ -30,7 +30,7 @@
android:clickable="true"
android:focusable="true"
android:orientation="vertical"
- android:background="@drawable/media_button">
+ android:background="?android:selectableItemBackground">
<TextView
android:id="@+id/title"
@@ -81,7 +81,7 @@
android:layout_height="fill_parent"
android:layout_weight="1"
android:scaleType="center"
- android:background="@drawable/media_button"
+ android:background="?android:selectableItemBackground"
android:src="@drawable/ic_appwidget_music_previous" />
<ImageButton
@@ -91,7 +91,7 @@
android:layout_weight="1"
android:scaleType="center"
android:src="@drawable/ic_appwidget_music_play"
- android:background="@drawable/media_button" />
+ android:background="?android:selectableItemBackground" />
<ImageButton
android:id="@+id/control_next"
@@ -100,7 +100,7 @@
android:layout_weight="1"
android:scaleType="center"
android:src="@drawable/ic_appwidget_music_next"
- android:background="@drawable/media_button" />
+ android:background="?android:selectableItemBackground" />
</LinearLayout>
</LinearLayout>
diff --git a/res/layout/appwidget4x2.xml b/res/layout/appwidget4x2.xml
index 0101f76a..8ec61a59 100644
--- a/res/layout/appwidget4x2.xml
+++ b/res/layout/appwidget4x2.xml
@@ -32,7 +32,7 @@
android:orientation="vertical"
android:paddingTop="4dip"
android:paddingBottom="4dip"
- android:background="@drawable/media_button">
+ android:background="?android:selectableItemBackground">
<TextView
android:id="@+id/title"
@@ -104,7 +104,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:scaleType="center"
- android:background="@drawable/media_button"
+ android:background="?android:selectableItemBackground"
android:src="@drawable/ic_appwidget_music_previous" />
<ImageButton
@@ -114,7 +114,7 @@
android:layout_weight="1"
android:scaleType="center"
android:src="@drawable/ic_appwidget_music_play"
- android:background="@drawable/media_button" />
+ android:background="?android:selectableItemBackground" />
<ImageButton
android:id="@+id/control_next"
@@ -123,7 +123,7 @@
android:layout_weight="1"
android:scaleType="center"
android:src="@drawable/ic_appwidget_music_next"
- android:background="@drawable/media_button" />
+ android:background="?android:selectableItemBackground" />
</LinearLayout>
</LinearLayout>
diff --git a/res/layout/appwidget4x3.xml b/res/layout/appwidget4x3.xml
index 70ab3648..1758602b 100644
--- a/res/layout/appwidget4x3.xml
+++ b/res/layout/appwidget4x3.xml
@@ -34,7 +34,7 @@
android:orientation="vertical"
android:paddingBottom="4dip"
android:paddingTop="4dip"
- android:background="@drawable/media_button">
+ android:background="?android:selectableItemBackground">
<TextView
android:id="@+id/title"
@@ -86,7 +86,7 @@
android:layout_height="56dip"
android:layout_weight="1"
android:scaleType="center"
- android:background="@drawable/media_button"
+ android:background="?android:selectableItemBackground"
android:src="@drawable/ic_appwidget_music_previous" />
<ImageButton
@@ -96,7 +96,7 @@
android:layout_weight="1"
android:scaleType="center"
android:src="@drawable/ic_appwidget_music_play"
- android:background="@drawable/media_button" />
+ android:background="?android:selectableItemBackground" />
<ImageButton
android:id="@+id/control_next"
@@ -105,7 +105,7 @@
android:layout_weight="1"
android:scaleType="center"
android:src="@drawable/ic_appwidget_music_next"
- android:background="@drawable/media_button" />
+ android:background="?android:selectableItemBackground" />
</LinearLayout>
</LinearLayout>
diff --git a/res/layout/appwidget4x4.xml b/res/layout/appwidget4x4.xml
index 302bf297..b15a7339 100644
--- a/res/layout/appwidget4x4.xml
+++ b/res/layout/appwidget4x4.xml
@@ -35,7 +35,7 @@
android:orientation="vertical"
android:paddingTop="4dip"
android:paddingBottom="4dip"
- android:background="@drawable/media_button">
+ android:background="?android:selectableItemBackground">
<TextView
android:id="@+id/title"
@@ -88,7 +88,7 @@
android:layout_height="56dip"
android:layout_weight="1"
android:scaleType="center"
- android:background="@drawable/media_button"
+ android:background="?android:selectableItemBackground"
android:src="@drawable/ic_appwidget_music_previous" />
<ImageButton
@@ -98,7 +98,7 @@
android:layout_weight="1"
android:scaleType="center"
android:src="@drawable/ic_appwidget_music_play"
- android:background="@drawable/media_button" />
+ android:background="?android:selectableItemBackground" />
<ImageButton
android:id="@+id/control_next"
@@ -107,7 +107,7 @@
android:layout_weight="1"
android:scaleType="center"
android:src="@drawable/ic_appwidget_music_next"
- android:background="@drawable/media_button" />
+ android:background="?android:selectableItemBackground" />
</LinearLayout>
</LinearLayout>
diff --git a/res/layout/basic_list_item.xml b/res/layout/basic_list_item.xml
index 2295a9ba..a49d0c3d 100644
--- a/res/layout/basic_list_item.xml
+++ b/res/layout/basic_list_item.xml
@@ -34,5 +34,5 @@
android:layout_height="fill_parent"
android:layout_gravity="right|center_vertical"
android:paddingRight="10dip"
- android:background="@drawable/menubar_button"/>
+ android:background="?android:selectableItemBackground"/>
</LinearLayout> \ No newline at end of file
diff --git a/res/layout/complex_list_item.xml b/res/layout/complex_list_item.xml
index 87fa7b2f..947b2ee0 100644
--- a/res/layout/complex_list_item.xml
+++ b/res/layout/complex_list_item.xml
@@ -46,5 +46,5 @@
android:layout_height="fill_parent"
android:layout_gravity="right|center_vertical"
android:paddingRight="10dip"
- android:background="@drawable/menubar_button"/>
+ android:background="?android:selectableItemBackground"/>
</LinearLayout> \ No newline at end of file
diff --git a/res/layout/notification.xml b/res/layout/notification.xml
index 55c7be2a..e4cec6fb 100644
--- a/res/layout/notification.xml
+++ b/res/layout/notification.xml
@@ -51,7 +51,7 @@
<ImageButton
android:id="@+id/control_previous"
android:src="@drawable/notification_previous"
- android:background="@drawable/btn_bg"
+ android:background="?android:selectableItemBackground"
android:layout_width="46dip"
android:layout_height="fill_parent"
android:layout_gravity="center|right"
@@ -62,7 +62,7 @@
<ImageButton
android:id="@+id/control_pause"
android:src="@drawable/notification_pause"
- android:background="@drawable/btn_bg"
+ android:background="?android:selectableItemBackground"
android:layout_width="46dip"
android:layout_height="fill_parent"
android:layout_gravity="center|right"
@@ -73,7 +73,7 @@
<ImageButton
android:id="@+id/control_next"
android:src="@drawable/notification_next"
- android:background="@drawable/btn_bg"
+ android:background="?android:selectableItemBackground"
android:layout_width="46dip"
android:layout_height="fill_parent"
android:layout_gravity="center|right"
diff --git a/res/layout/notification_expanded.xml b/res/layout/notification_expanded.xml
index 5fc4156a..fe864ce3 100644
--- a/res/layout/notification_expanded.xml
+++ b/res/layout/notification_expanded.xml
@@ -40,7 +40,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/notification_close"
- android:background="@drawable/btn_bg"
+ android:background="?android:selectableItemBackground"
android:padding="10dip"
android:layout_gravity="right"
android:visibility="gone"/>
@@ -70,6 +70,11 @@
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="fill_parent" />
+
+ <ImageView
+ android:background="?android:dividerHorizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="1.0px"/>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
@@ -86,7 +91,7 @@
android:layout_gravity="center"
android:layout_weight="1"
android:padding="10dip"
- android:background="@drawable/btn_bg"
+ android:background="?android:selectableItemBackground"
android:scaleType="fitCenter"
android:src="@drawable/notification_previous" />
@@ -97,7 +102,7 @@
android:layout_gravity="center"
android:layout_weight="1"
android:padding="10dip"
- android:background="@drawable/btn_bg"
+ android:background="?android:selectableItemBackground"
android:scaleType="fitCenter"
android:src="@drawable/notification_pause" />
@@ -108,7 +113,7 @@
android:layout_gravity="center"
android:layout_weight="1"
android:padding="10dip"
- android:background="@drawable/btn_bg"
+ android:background="?android:selectableItemBackground"
android:scaleType="fitCenter"
android:src="@drawable/notification_next" />
</LinearLayout>
diff --git a/res/layout/select_album_header.xml b/res/layout/select_album_header.xml
index f803f3af..eb8346c3 100644
--- a/res/layout/select_album_header.xml
+++ b/res/layout/select_album_header.xml
@@ -80,7 +80,7 @@
android:padding="10dip"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
- android:background="@drawable/menubar_button"/>
+ android:background="?android:selectableItemBackground"/>
</RelativeLayout>
diff --git a/res/layout/song_list_item.xml b/res/layout/song_list_item.xml
index 72ee298b..5b4a2895 100644
--- a/res/layout/song_list_item.xml
+++ b/res/layout/song_list_item.xml
@@ -102,5 +102,5 @@
android:layout_height="fill_parent"
android:layout_gravity="right|center_vertical"
android:paddingRight="10dip"
- android:background="@drawable/menubar_button"/>
+ android:background="?android:selectableItemBackground"/>
</LinearLayout>
diff --git a/res/layout/user_list_item.xml b/res/layout/user_list_item.xml
index 657dd910..d9b15cd0 100644
--- a/res/layout/user_list_item.xml
+++ b/res/layout/user_list_item.xml
@@ -41,5 +41,5 @@
android:layout_height="fill_parent"
android:layout_gravity="right|center_vertical"
android:paddingRight="10dip"
- android:background="@drawable/menubar_button"/>
+ android:background="?android:selectableItemBackground"/>
</LinearLayout> \ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 89492cd7..77f18ea9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -284,8 +284,8 @@
<string name="settings.theme_fullscreen_summary">Hide as many UI elements as Android will allow</string>
<string name="settings.track_title">Display Track #</string>
<string name="settings.track_summary">Display Track # in front of songs if one exists</string>
- <string name="settings.custom_sort">Custom Sort</string>
- <string name="settings.custom_sort_summary">Override default server sorting to sort by disc number and by year.</string>
+ <string name="settings.custom_sort">Sort By Year</string>
+ <string name="settings.custom_sort_summary">Sort albums by year, or by alphabetical</string>
<string name="settings.open_to_library">Open To Library</string>
<string name="settings.open_to_library_summary">Open directly to the library screen instead of opening to home.</string>
<string name="settings.network_title">Network</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index e64e5313..103e4e49 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="PlaybackControl">
- <item name="android:background">@drawable/media_button</item>
+ <item name="android:background">?android:selectableItemBackground</item>
<item name="android:scaleType">fitCenter</item>
<item name="android:padding">6dip</item>
<item name="android:layout_marginLeft">4dip</item>
@@ -23,7 +23,7 @@
<item name="android:layout_weight">1</item>
<item name="android:textSize">14sp</item>
<item name="android:textStyle">bold</item>
- <item name="android:background">@drawable/menubar_button</item>
+ <item name="android:background">?android:selectableItemBackground</item>
<item name="android:textColor">?android:textColorPrimary</item>
</style>
@@ -32,7 +32,7 @@
<item name="android:layout_height">wrap_content</item>
<item name="android:textStyle">bold</item>
<item name="android:textSize">22sp</item>
- <item name="android:background">@drawable/menubar_button</item>
+ <item name="android:background">?android:selectableItemBackground</item>
<item name="android:paddingTop">4dip</item>
<item name="android:paddingBottom">4dip</item>
<item name="android:paddingRight">4dip</item>
@@ -42,7 +42,7 @@
<style name="DownloadActionImageButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
- <item name="android:background">@drawable/menubar_button</item>
+ <item name="android:background">?android:selectableItemBackground</item>
<item name="android:paddingTop">8dip</item>
<item name="android:paddingBottom">8dip</item>
<item name="android:paddingRight">16dip</item>
diff --git a/res/xml/changelog.xml b/res/xml/changelog.xml
index 28e8153e..5499f454 100644
--- a/res/xml/changelog.xml
+++ b/res/xml/changelog.xml
@@ -1,5 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<changelog>
+ <release version="4.7.2" versioncode="115" releasedate="7/10/2014">
+ <change>Android Wear notification support</change>
+ <change>Selected drawer tab is now bold</change>
+ <change>Scroll to song when clicked in search results</change>
+ <change>Custom sort is now a toggle between sorting by year and alphabetical</change>
+ <change>For persistent notification, use standard notification layout + x in corner</change>
+ <change>Don't display type information for each song</change>
+ <change>Return fast scrolling hack for devices still on Android 4.4.2</change>
+ <change>Various bug fixes and enhancements</change>
+ </release>
<release version="4.7.1" versioncode="113" releasedate="6/25/2014">
<change>Only show podcast, share, and jukebox options when user has server permissions</change>
<change>Remove playlist options from public, non-owned lists (throws error anyways)</change>
diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
index 395a347e..92775f3e 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -494,7 +494,10 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
}
public boolean onBackPressedSupport() {
- if(backStack.size() > 0) {
+ if(drawerOpen) {
+ drawer.closeDrawers();
+ return false;
+ } else if(backStack.size() > 0) {
removeCurrent();
return false;
} else {
diff --git a/src/github/daneren2005/dsub/domain/MusicDirectory.java b/src/github/daneren2005/dsub/domain/MusicDirectory.java
index c284ba00..492726f9 100644
--- a/src/github/daneren2005/dsub/domain/MusicDirectory.java
+++ b/src/github/daneren2005/dsub/domain/MusicDirectory.java
@@ -102,8 +102,8 @@ public class MusicDirectory implements Serializable {
return children.size();
}
- public void sortChildren() {
- EntryComparator.sort(children);
+ public void sortChildren(boolean byYear) {
+ EntryComparator.sort(children, byYear);
}
public static class Entry implements Serializable {
@@ -422,23 +422,31 @@ public class MusicDirectory implements Serializable {
}
public static class EntryComparator implements Comparator<Entry> {
+ private boolean byYear;
+
+ public EntryComparator(boolean byYear) {
+ this.byYear = byYear;
+ }
+
public int compare(Entry lhs, Entry rhs) {
if(lhs.isDirectory() && !rhs.isDirectory()) {
return -1;
} else if(!lhs.isDirectory() && rhs.isDirectory()) {
return 1;
} else if(lhs.isDirectory() && rhs.isDirectory()) {
- Integer lhsYear = lhs.getYear();
- Integer rhsYear = rhs.getYear();
- if(lhsYear != null && rhsYear != null) {
- return lhsYear.compareTo(rhsYear);
- } else if(lhsYear != null) {
- return -1;
- } else if(rhsYear != null) {
- return 1;
- } else {
- return lhs.getTitle().compareToIgnoreCase(rhs.getTitle());
+ if(byYear) {
+ Integer lhsYear = lhs.getYear();
+ Integer rhsYear = rhs.getYear();
+ if(lhsYear != null && rhsYear != null) {
+ return lhsYear.compareTo(rhsYear);
+ } else if(lhsYear != null) {
+ return -1;
+ } else if(rhsYear != null) {
+ return 1;
+ }
}
+
+ return lhs.getTitle().compareToIgnoreCase(rhs.getTitle());
}
Integer lhsDisc = lhs.getDiscNumber();
@@ -466,8 +474,11 @@ public class MusicDirectory implements Serializable {
}
public static void sort(List<Entry> entries) {
+ sort(entries, true);
+ }
+ public static void sort(List<Entry> entries, boolean byYear) {
try {
- Collections.sort(entries, new EntryComparator());
+ Collections.sort(entries, new EntryComparator(byYear));
} catch (Exception e) {
Log.w(TAG, "Failed to sort MusicDirectory");
}
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index d40f8fad..fea3d44c 100644
--- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -164,28 +164,8 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
setupScrollList(albumList);
}
- albumList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
- @Override
- public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
- MusicDirectory.Entry entry = (MusicDirectory.Entry) parent.getItemAtPosition(position);
- SubsonicFragment fragment = new SelectDirectoryFragment();
- Bundle args = new Bundle();
- args.putString(Constants.INTENT_EXTRA_NAME_ID, entry.getId());
- args.putString(Constants.INTENT_EXTRA_NAME_NAME, entry.getTitle());
- if ("newest".equals(albumListType)) {
- args.putBoolean(Constants.INTENT_EXTRA_REFRESH_LISTINGS, true);
- }
- if(entry.getArtist() == null && entry.getParent() == null) {
- args.putBoolean(Constants.INTENT_EXTRA_NAME_ARTIST, true);
- }
- fragment.setArguments(args);
-
- replaceFragment(fragment, true);
- }
- });
-
registerForContextMenu(entryList);
- registerForContextMenu(albumList);
+ setupAlbumList();
if(entries == null) {
if(primaryFragment || secondaryFragment) {
@@ -662,7 +642,17 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
// Needs to be added here, GB crashes if you to try to remove the header view before adapter is set
if(addAlbumHeader) {
- entryList.addHeaderView(albumList);
+ if(entries.size() > 0) {
+ entryList.addHeaderView(albumList);
+ } else {
+ ViewGroup rootGroup = (ViewGroup) rootView.findViewById(R.id.select_album_layout);
+ albumList = (GridView) context.getLayoutInflater().inflate(R.layout.grid_view, rootGroup, false);
+ rootGroup.removeView(entryList);
+ rootGroup.addView(albumList);
+
+ setupScrollList(albumList);
+ setupAlbumList();
+ }
addAlbumHeader = false;
}
@@ -718,6 +708,31 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
}
}
+ private void setupAlbumList() {
+ albumList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ MusicDirectory.Entry entry = (MusicDirectory.Entry) parent.getItemAtPosition(position);
+ SubsonicFragment fragment = new SelectDirectoryFragment();
+ Bundle args = new Bundle();
+ args.putString(Constants.INTENT_EXTRA_NAME_ID, entry.getId());
+ args.putString(Constants.INTENT_EXTRA_NAME_NAME, entry.getTitle());
+ if ("newest".equals(albumListType)) {
+ args.putBoolean(Constants.INTENT_EXTRA_REFRESH_LISTINGS, true);
+ }
+ if(entry.getArtist() == null && entry.getParent() == null) {
+ args.putBoolean(Constants.INTENT_EXTRA_NAME_ARTIST, true);
+ }
+ fragment.setArguments(args);
+
+ replaceFragment(fragment, true);
+ }
+ });
+
+ registerForContextMenu(entryList);
+ registerForContextMenu(albumList);
+ }
+
private void playNow(final boolean shuffle, final boolean append) {
playNow(shuffle, append, false);
}
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java
index f28c38dc..f458379d 100644
--- a/src/github/daneren2005/dsub/service/DownloadService.java
+++ b/src/github/daneren2005/dsub/service/DownloadService.java
@@ -700,6 +700,7 @@ public class DownloadService extends Service {
nextPlayingTask = new CheckCompletionTask(nextPlaying);
nextPlayingTask.execute();
} else {
+ resetNext();
nextPlaying = null;
}
}
@@ -934,6 +935,8 @@ public class DownloadService extends Service {
mediaPlayer.pause();
}
setPlayerState(temp ? PAUSED_TEMP : PAUSED);
+ } else if(playerState == PAUSED_TEMP) {
+ setPlayerState(temp ? PAUSED_TEMP : PAUSED);
}
} catch (Exception x) {
handleError(x);
@@ -994,6 +997,25 @@ public class DownloadService extends Service {
}
}
+ public synchronized void resetNext() {
+ try {
+ if (nextMediaPlayer != null) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && nextSetup) {
+ mediaPlayer.setNextMediaPlayer(null);
+ nextSetup = false;
+ }
+
+ nextMediaPlayer.setOnCompletionListener(null);
+ nextMediaPlayer.setOnErrorListener(null);
+ nextMediaPlayer.reset();
+ nextMediaPlayer.release();
+ nextMediaPlayer = null;
+ }
+ } catch (Exception e) {
+ Log.w(TAG, "Failed to reset next media player");
+ }
+ }
+
public int getPlayerPosition() {
try {
if (playerState == IDLE || playerState == DOWNLOADING || playerState == PREPARING) {
@@ -1395,13 +1417,7 @@ public class DownloadService extends Service {
private synchronized void setupNext(final DownloadFile downloadFile) {
try {
final File file = downloadFile.isCompleteFileAvailable() ? downloadFile.getCompleteFile() : downloadFile.getPartialFile();
- if(nextMediaPlayer != null) {
- nextMediaPlayer.setOnCompletionListener(null);
- nextMediaPlayer.setOnErrorListener(null);
- nextMediaPlayer.reset();
- nextMediaPlayer.release();
- nextMediaPlayer = null;
- }
+ resetNext();
// Exit when using remote controllers
if(remoteState != RemoteControlState.LOCAL) {
diff --git a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
index 76c9abeb..18502846 100644
--- a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
+++ b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
@@ -332,7 +332,9 @@ public class DownloadServiceLifecycleSupport {
case TelephonyManager.CALL_STATE_IDLE:
if (resumeAfterCall) {
resumeAfterCall = false;
- downloadService.start();
+ if(downloadService.getPlayerState() == PlayerState.PAUSED_TEMP) {
+ downloadService.start();
+ }
}
break;
default:
diff --git a/src/github/daneren2005/dsub/service/OfflineMusicService.java b/src/github/daneren2005/dsub/service/OfflineMusicService.java
index a92e41d1..04955cc3 100644
--- a/src/github/daneren2005/dsub/service/OfflineMusicService.java
+++ b/src/github/daneren2005/dsub/service/OfflineMusicService.java
@@ -134,7 +134,7 @@ public class OfflineMusicService extends RESTMusicService {
result.addChild(createEntry(context, file, name, true, isPodcast));
}
}
- result.sortChildren();
+ result.sortChildren(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_CUSTOM_SORT_ENABLED, true));
return result;
}
diff --git a/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java b/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java
index e705c54d..95ee1744 100644
--- a/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java
+++ b/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java
@@ -97,8 +97,8 @@ public class MusicDirectoryParser extends MusicDirectoryEntryParser {
validate();
// Only apply sorting on server version 4.7 and greater, where disc is supported
- if(Util.checkServerVersion(context, "1.8.0") && Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_CUSTOM_SORT_ENABLED, true)) {
- dir.sortChildren();
+ if(Util.checkServerVersion(context, "1.8.0")) {
+ dir.sortChildren(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_CUSTOM_SORT_ENABLED, true));
}
return dir;
diff --git a/src/github/daneren2005/dsub/util/Notifications.java b/src/github/daneren2005/dsub/util/Notifications.java
index de4129e9..75c69d9e 100644
--- a/src/github/daneren2005/dsub/util/Notifications.java
+++ b/src/github/daneren2005/dsub/util/Notifications.java
@@ -65,13 +65,13 @@ public final class Notifications {
boolean remote = downloadService.isRemoteEnabled();
if (Build.VERSION.SDK_INT>= Build.VERSION_CODES.JELLY_BEAN){
RemoteViews expandedContentView = new RemoteViews(context.getPackageName(), R.layout.notification_expanded);
- setupViews(expandedContentView,context,song, playing, remote);
+ setupViews(expandedContentView ,context, song, true, playing, remote);
notification.bigContentView = expandedContentView;
notification.priority = Notification.PRIORITY_HIGH;
}
RemoteViews smallContentView = new RemoteViews(context.getPackageName(), R.layout.notification);
- setupViews(smallContentView, context, song, playing, remote);
+ setupViews(smallContentView, context, song, false, playing, remote);
notification.contentView = smallContentView;
Intent notificationIntent = new Intent(context, SubsonicFragmentActivity.class);
@@ -103,7 +103,7 @@ public final class Notifications {
DSubWidgetProvider.notifyInstances(context, downloadService, playing);
}
- private static void setupViews(RemoteViews rv, Context context, MusicDirectory.Entry song, boolean playing, boolean remote){
+ private static void setupViews(RemoteViews rv, Context context, MusicDirectory.Entry song, boolean expanded, boolean playing, boolean remote){
// Use the same text for the ticker and the expanded notification
String title = song.getTitle();
@@ -141,16 +141,21 @@ public final class Notifications {
rv.setTextColor(R.id.notification_artist, colors.getSecond());
}
- if(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_PERSISTENT_NOTIFICATION, false)) {
- rv.setImageViewResource(R.id.control_previous, playing ? R.drawable.notification_pause : R.drawable.notification_play);
- rv.setImageViewResource(R.id.control_pause, R.drawable.notification_next);
- rv.setImageViewResource(R.id.control_next, R.drawable.notification_close);
+ boolean persistent = Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_PERSISTENT_NOTIFICATION, false);
+ if(persistent) {
+ if(expanded) {
+ rv.setImageViewResource(R.id.control_pause, playing ? R.drawable.notification_pause : R.drawable.notification_play);
+ } else {
+ rv.setImageViewResource(R.id.control_previous, playing ? R.drawable.notification_pause : R.drawable.notification_play);
+ rv.setImageViewResource(R.id.control_pause, R.drawable.notification_next);
+ rv.setImageViewResource(R.id.control_next, R.drawable.notification_close);
+ }
}
// Create actions for media buttons
PendingIntent pendingIntent;
int previous = 0, pause = 0, next = 0, close = 0;
- if(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_PERSISTENT_NOTIFICATION, false)) {
+ if(persistent && !expanded) {
pause = R.id.control_previous;
next = R.id.control_pause;
close = R.id.control_next;
@@ -160,7 +165,7 @@ public final class Notifications {
next = R.id.control_next;
}
- if(remote && close == 0) {
+ if((remote || persistent) && close == 0) {
close = R.id.notification_close;
rv.setViewVisibility(close, View.VISIBLE);
}
diff --git a/src/github/daneren2005/dsub/view/SongView.java b/src/github/daneren2005/dsub/view/SongView.java
index 3e423877..e6156ceb 100644
--- a/src/github/daneren2005/dsub/view/SongView.java
+++ b/src/github/daneren2005/dsub/view/SongView.java
@@ -48,6 +48,7 @@ public class SongView extends UpdateView implements Checkable {
private TextView durationTextView;
private TextView statusTextView;
private ImageView statusImageView;
+ private View bottomRowView;
private DownloadService downloadService;
private long revision = -1;
@@ -80,6 +81,7 @@ public class SongView extends UpdateView implements Checkable {
v.showContextMenu();
}
});
+ bottomRowView = findViewById(R.id.song_bottom);
}
public void setObjectImpl(Object obj1, Object obj2) {
@@ -120,8 +122,9 @@ public class SongView extends UpdateView implements Checkable {
}
durationTextView.setText(Util.formatDuration(song.getDuration()));
+ bottomRowView.setVisibility(View.VISIBLE);
} else {
- findViewById(R.id.song_bottom).setVisibility(View.GONE);
+ bottomRowView.setVisibility(View.GONE);
statusTextView.setText(Util.formatDuration(song.getDuration()));
}