diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-11-08 19:33:22 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-11-08 19:33:22 -0800 |
commit | 1d6294de8292f6945534f3ed4819b86d11c6ea75 (patch) | |
tree | 316b4fa7af34dfefafb44e4e77ab39501f940d74 | |
parent | b7a29c6058b9e0f1ddb493f55e933062b913484e (diff) | |
download | dsub-1d6294de8292f6945534f3ed4819b86d11c6ea75.tar.gz dsub-1d6294de8292f6945534f3ed4819b86d11c6ea75.tar.bz2 dsub-1d6294de8292f6945534f3ed4819b86d11c6ea75.zip |
Added bookmarks tab to layout, more optimizations
-rw-r--r-- | res/menu/abstract_top_menu.xml (renamed from res/menu/select_playlist.xml) | 50 | ||||
-rw-r--r-- | res/menu/select_podcasts.xml | 6 | ||||
-rw-r--r-- | res/values/arrays.xml | 8 | ||||
-rw-r--r-- | res/values/strings.xml | 3 | ||||
-rw-r--r-- | res/xml/settings.xml | 6 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/activity/SubsonicActivity.java | 39 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java | 3 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java | 4 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java | 2 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/util/Constants.java | 1 |
10 files changed, 68 insertions, 54 deletions
diff --git a/res/menu/select_playlist.xml b/res/menu/abstract_top_menu.xml index 68904502..98f9884e 100644 --- a/res/menu/select_playlist.xml +++ b/res/menu/abstract_top_menu.xml @@ -1,25 +1,25 @@ -<?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:compat="http://schemas.android.com/apk/res-auto"> - <item - android:id="@+id/menu_refresh" - android:icon="@drawable/action_refresh" - android:title="@string/menu.refresh" - compat:showAsAction="always|withText"/> - - <item - android:id="@+id/menu_search" - android:icon="@drawable/action_search" - android:title="@string/menu.search" - compat:showAsAction="always|withText"/> - - <item - android:id="@+id/menu_settings" - android:icon="@drawable/action_settings" - android:title="@string/menu.settings"/> - - <item - android:id="@+id/menu_exit" - android:icon="@drawable/action_exit" - android:title="@string/menu.exit"/> -</menu> +<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:compat="http://schemas.android.com/apk/res-auto">
+ <item
+ android:id="@+id/menu_refresh"
+ android:icon="@drawable/action_refresh"
+ android:title="@string/menu.refresh"
+ compat:showAsAction="always|withText"/>
+
+ <item
+ android:id="@+id/menu_search"
+ android:icon="@drawable/action_search"
+ android:title="@string/menu.search"
+ compat:showAsAction="always|withText"/>
+
+ <item
+ android:id="@+id/menu_settings"
+ android:icon="@drawable/action_settings"
+ android:title="@string/menu.settings"/>
+
+ <item
+ android:id="@+id/menu_exit"
+ android:icon="@drawable/action_exit"
+ android:title="@string/menu.exit"/>
+</menu>
diff --git a/res/menu/select_podcasts.xml b/res/menu/select_podcasts.xml index 6311eaca..de6b83a7 100644 --- a/res/menu/select_podcasts.xml +++ b/res/menu/select_podcasts.xml @@ -7,6 +7,12 @@ android:title="@string/menu.refresh" compat:showAsAction="always|withText"/> + <item + android:id="@+id/menu_search" + android:icon="@drawable/action_search" + android:title="@string/menu.search" + compat:showAsAction="always|withText"/> + <item android:id="@+id/menu_add_podcast" android:icon="@drawable/action_exit" diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 6d35f984..21b500d2 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -5,14 +5,16 @@ <item>@string/button_bar.browse</item> <item>@string/button_bar.playlists</item> <item>@string/button_bar.podcasts</item> + <item>@string/button_bar.bookmarks</item> <item>@string/button_bar.chat</item> </string-array> <string-array name="drawerItemsDescriptions"> <item>Home</item> - <item>Library</item> - <item>Playlists</item> - <item>Podcasts</item> + <item>Artist</item> + <item>Playlist</item> + <item>Podcast</item> + <item>Bookmark</item> <item>Chat</item> </string-array> diff --git a/res/values/strings.xml b/res/values/strings.xml index d162cd81..4eb57348 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -30,6 +30,7 @@ <string name="button_bar.playlists">Playlists</string>
<string name="button_bar.now_playing">Now Playing</string>
<string name="button_bar.podcasts">Podcasts</string>
+ <string name="button_bar.bookmarks">Bookmarks</string>
<string name="button_bar.chat">Chat</string>
<string name="main.welcome_title">Welcome!</string>
@@ -332,6 +333,8 @@ <string name="settings.hide_widget_summary">Hide widget after exiting app</string>
<string name="settings.podcasts_enabled">Podcasts Enabled</string>
<string name="settings.podcasts_enabled_summary">Whether or not to display the podcast listing in the pull out drawer</string>
+ <string name="settings.bookmarks_enabled">Bookmarks Enabled</string>
+ <string name="settings.bookmarks_enabled_summary">Whether or not to display the bookmarks listing in the pull out drawer</string>
<string name="shuffle.title">Shuffle By</string>
<string name="shuffle.startYear">Start Year:</string>
diff --git a/res/xml/settings.xml b/res/xml/settings.xml index a53b1ee4..f83f361c 100644 --- a/res/xml/settings.xml +++ b/res/xml/settings.xml @@ -69,6 +69,12 @@ android:summary="@string/settings.podcasts_enabled_summary" android:key="podcastsEnabled" android:defaultValue="true"/> + + <CheckBoxPreference + android:title="@string/settings.bookmarks_enabled" + android:summary="@string/settings.bookmarks_enabled_summary" + android:key="bookmarksEnabled" + android:defaultValue="true"/> </PreferenceCategory> </PreferenceScreen> 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"; |