From 5216400fcb830bdc45d3d4f76f3af60ca14771ac Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Fri, 14 Sep 2012 20:51:27 -0700 Subject: Fix for NullException on offline album viewing --- .../daneren2005/dsub/activity/SelectAlbumActivity.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java index 9d1936ab..b0c47a5e 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java @@ -56,6 +56,7 @@ public class SelectAlbumActivity extends SubsonicTabActivity { private ListView entryList; private View footer; private View emptyView; + private boolean hideButtons = false; private com.actionbarsherlock.view.MenuItem selectAll; private com.actionbarsherlock.view.MenuItem cache; private com.actionbarsherlock.view.MenuItem delete; @@ -122,6 +123,13 @@ public class SelectAlbumActivity extends SubsonicTabActivity { cache = menu.findItem(R.id.menu_cache); delete = menu.findItem(R.id.menu_delete); playLast = menu.findItem(R.id.menu_play_last); + if(hideButtons) { + selectAll.setVisible(false); + cache.setVisible(false); + delete.setVisible(false); + playLast.setVisible(false); + hideButtons = false; + } return true; } @@ -505,11 +513,13 @@ public class SelectAlbumActivity extends SubsonicTabActivity { if (songCount > 0) { getImageLoader().loadImage(getSupportActionBar(), entries.get(0)); entryList.addFooterView(footer); - } else { + } else if(selectAll != null) { selectAll.setVisible(false); cache.setVisible(false); delete.setVisible(false); playLast.setVisible(false); + } else { + hideButtons = true; } emptyView.setVisibility(entries.isEmpty() ? View.VISIBLE : View.GONE); -- cgit v1.2.3