aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-11-08 19:33:22 -0800
committerScott Jackson <daneren2005@gmail.com>2013-11-08 19:33:22 -0800
commit1d6294de8292f6945534f3ed4819b86d11c6ea75 (patch)
tree316b4fa7af34dfefafb44e4e77ab39501f940d74 /src/github
parentb7a29c6058b9e0f1ddb493f55e933062b913484e (diff)
downloaddsub-1d6294de8292f6945534f3ed4819b86d11c6ea75.tar.gz
dsub-1d6294de8292f6945534f3ed4819b86d11c6ea75.tar.bz2
dsub-1d6294de8292f6945534f3ed4819b86d11c6ea75.zip
Added bookmarks tab to layout, more optimizations
Diffstat (limited to 'src/github')
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicActivity.java39
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java3
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java4
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java2
-rw-r--r--src/github/daneren2005/dsub/util/Constants.java1
5 files changed, 23 insertions, 26 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
index 68f398bc..135a76a2 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -71,7 +71,7 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
private String[] drawerItemsDescriptions;
private String[] drawerItems;
private boolean drawerIdle = true;
- private boolean[] enabledItems = {true, true};
+ private boolean[] enabledItems = {true, true, true};
private boolean destroyed = false;
private boolean finished = false;
protected List<SubsonicFragment> backStack = new ArrayList<SubsonicFragment>();
@@ -152,23 +152,7 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
drawerList.setOnItemClickListener(new ListView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
- if("Home".equals(drawerItemsDescriptions[position])) {
- startFragmentActivity("");
- } else if("Library".equals(drawerItemsDescriptions[position])) {
- startFragmentActivity("Artist");
- } else if("Playlists".equals(drawerItemsDescriptions[position])) {
- startFragmentActivity("Playlist");
- } else if("Podcasts".equals(drawerItemsDescriptions[position])) {
- startFragmentActivity("Podcast");
- } else if("Chat".equals(drawerItemsDescriptions[position])) {
- startFragmentActivity("Chat");
- } else if("Now Playing".equals(drawerItemsDescriptions[position])) {
- startActivity(DownloadActivity.class);
- } else if("Settings".equals(drawerItemsDescriptions[position])) {
- startActivity(SettingsActivity.class);
- } else if("Exit".equals(drawerItemsDescriptions[position])) {
- exit();
- }
+ startFragmentActivity(drawerItemsDescriptions[position]);
if(lastSelectedView != view) {
lastSelectedView.setBackgroundResource(android.R.color.transparent);
@@ -372,9 +356,10 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
private void populateDrawer() {
SharedPreferences prefs = Util.getPreferences(this);
boolean podcastsEnabled = prefs.getBoolean(Constants.PREFERENCES_KEY_PODCASTS_ENABLED, true);
+ boolean bookmarksEnabled = prefs.getBoolean(Constants.PREFERENCES_KEY_BOOKMARKS_ENABLED, true);
boolean chatEnabled = prefs.getBoolean(Constants.PREFERENCES_KEY_CHAT_ENABLED, true);
- if(drawerItems == null || !enabledItems[0] == podcastsEnabled || !enabledItems[1] == chatEnabled) {
+ if(drawerItems == null || !enabledItems[0] == podcastsEnabled || !enabledItems[1] == bookmarksEnabled || !enabledItems[2] == chatEnabled) {
drawerItems = getResources().getStringArray(R.array.drawerItems);
drawerItemsDescriptions = getResources().getStringArray(R.array.drawerItemsDescriptions);
@@ -389,14 +374,21 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
drawerItemsDescriptionsList.remove(3 - alreadyRemoved);
alreadyRemoved++;
}
-
- // Selectively remove chat listing: [4]
- if(!chatEnabled) {
+
+ // Selectively remove bookmarks listing [4]
+ if(!bookmarksEnabled) {
drawerItemsList.remove(4 - alreadyRemoved);
drawerItemsDescriptionsList.remove(4 - alreadyRemoved);
alreadyRemoved++;
}
+ // Selectively remove chat listing: [5]
+ if(!chatEnabled) {
+ drawerItemsList.remove(5 - alreadyRemoved);
+ drawerItemsDescriptionsList.remove(5 - alreadyRemoved);
+ alreadyRemoved++;
+ }
+
// Put list back together
if(alreadyRemoved > 0) {
drawerItems = drawerItemsList.toArray(new String[0]);
@@ -405,7 +397,8 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
drawerList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, drawerItems));
enabledItems[0] = podcastsEnabled;
- enabledItems[1] = chatEnabled;
+ enabledItems[1] = bookmarksEnabled;
+ enabledItems[2] = chatEnabled;
}
}
diff --git a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
index 9c006ae1..5fe7333d 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
@@ -44,6 +44,7 @@ import github.daneren2005.dsub.fragments.ChatFragment;
import github.daneren2005.dsub.fragments.MainFragment;
import github.daneren2005.dsub.fragments.SearchFragment;
import github.daneren2005.dsub.fragments.SelectArtistFragment;
+import github.daneren2005.dsub.fragments.SelectBookmarkFragment;
import github.daneren2005.dsub.fragments.SelectDirectoryFragment;
import github.daneren2005.dsub.fragments.SelectPlaylistFragment;
import github.daneren2005.dsub.fragments.SelectPodcastsFragment;
@@ -332,6 +333,8 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
return new ChatFragment();
} else if("Podcast".equals(fragmentType)) {
return new SelectPodcastsFragment();
+ } else if("Bookmark".equals(fragmentType)) {
+ return new SelectBookmarkFragment();
} else {
return new MainFragment();
}
diff --git a/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java b/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java
index cf57ce58..b0969b29 100644
--- a/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java
@@ -80,7 +80,7 @@ public class SelectBookmarkFragment extends SubsonicFragment implements AdapterV
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
- menuInflater.inflate(R.menu.select_genres, menu);
+ menuInflater.inflate(R.menu.abstract_top_menu, menu);
}
@Override
@@ -94,7 +94,7 @@ public class SelectBookmarkFragment extends SubsonicFragment implements AdapterV
@Override
protected void refresh(final boolean refresh) {
- setTitle(R.string.main_albums_genres);
+ setTitle(R.string.button_bar_bookmarks);
bookmarkListView.setVisibility(View.INVISIBLE);
BackgroundTask<List<Bookmark>> task = new TabBackgroundTask<List<Bookmark>>(this) {
diff --git a/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java b/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java
index 9ae229b8..79889c2c 100644
--- a/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java
@@ -81,7 +81,7 @@ public class SelectPlaylistFragment extends SubsonicFragment implements AdapterV
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
- menuInflater.inflate(R.menu.select_playlist, menu);
+ menuInflater.inflate(R.menu.abstract_top_menu, menu);
}
@Override
diff --git a/src/github/daneren2005/dsub/util/Constants.java b/src/github/daneren2005/dsub/util/Constants.java
index fece424b..efcaf2d3 100644
--- a/src/github/daneren2005/dsub/util/Constants.java
+++ b/src/github/daneren2005/dsub/util/Constants.java
@@ -121,6 +121,7 @@ public final class Constants {
public static final String PREFERENCES_KEY_PAUSE_DISCONNECT = "pauseOnDisconnect";
public static final String PREFERENCES_KEY_HIDE_WIDGET = "hideWidget";
public static final String PREFERENCES_KEY_PODCASTS_ENABLED = "podcastsEnabled";
+ public static final String PREFERENCES_KEY_BOOKMARKS_ENABLED = "bookmarksEnabled";
public static final String OFFLINE_SCROBBLE_COUNT = "scrobbleCount";
public static final String OFFLINE_SCROBBLE_ID = "scrobbleID";