aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java12
-rw-r--r--app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java3
-rw-r--r--app/src/main/java/github/daneren2005/dsub/adapter/InternetRadioStationAdapter.java56
-rw-r--r--app/src/main/java/github/daneren2005/dsub/domain/InternetRadioStation.java43
-rw-r--r--app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java3
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/SelectInternetRadioStationFragment.java94
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java17
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/MusicService.java3
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/OfflineMusicService.java6
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java13
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/parser/InternetRadioStationParser.java63
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Constants.java1
-rw-r--r--app/src/main/java/github/daneren2005/dsub/view/InternetRadioStationView.java39
-rw-r--r--app/src/main/res/menu/drawer_navigation.xml4
-rw-r--r--app/src/main/res/menu/select_internet_radio_context.xml7
-rw-r--r--app/src/main/res/values/arrays.xml2
-rw-r--r--app/src/main/res/values/attrs.xml1
-rw-r--r--app/src/main/res/values/strings.xml6
-rw-r--r--app/src/main/res/values/themes.xml2
-rw-r--r--app/src/main/res/xml/settings_drawer.xml6
20 files changed, 381 insertions, 0 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java
index 8882ad98..9b14f4f6 100644
--- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -162,6 +162,9 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte
case Constants.PREFERENCES_KEY_BOOKMARKS_ENABLED:
setDrawerItemVisible(R.id.drawer_bookmarks, false);
break;
+ case Constants.PREFERENCES_KEY_INTERNET_RADIO_ENABLED:
+ setDrawerItemVisible(R.id.drawer_internet_radio_stations, false);
+ break;
case Constants.PREFERENCES_KEY_SHARED_ENABLED:
setDrawerItemVisible(R.id.drawer_shares, false);
break;
@@ -311,6 +314,9 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte
case R.id.drawer_bookmarks:
drawerItemSelected("Bookmark");
return true;
+ case R.id.drawer_internet_radio_stations:
+ drawerItemSelected("Internet Radio");
+ return true;
case R.id.drawer_shares:
drawerItemSelected("Share");
return true;
@@ -586,6 +592,7 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte
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) && !Util.isOffline(this) && ServerInfo.canBookmark(this);
+ boolean internetRadioEnabled = prefs.getBoolean(Constants.PREFERENCES_KEY_INTERNET_RADIO_ENABLED, true) && !Util.isOffline(this) && ServerInfo.canInternetRadio(this);
boolean sharedEnabled = prefs.getBoolean(Constants.PREFERENCES_KEY_SHARED_ENABLED, true) && !Util.isOffline(this);
boolean chatEnabled = prefs.getBoolean(Constants.PREFERENCES_KEY_CHAT_ENABLED, true) && !Util.isOffline(this);
boolean adminEnabled = prefs.getBoolean(Constants.PREFERENCES_KEY_ADMIN_ENABLED, true) && !Util.isOffline(this);
@@ -615,6 +622,9 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte
if(!bookmarksEnabled) {
setDrawerItemVisible(R.id.drawer_bookmarks, false);
}
+ if(!internetRadioEnabled) {
+ setDrawerItemVisible(R.id.drawer_internet_radio_stations, false);
+ }
if(!sharedEnabled) {
setDrawerItemVisible(R.id.drawer_shares, false);
}
@@ -1191,6 +1201,8 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte
return R.id.drawer_podcasts;
case "Bookmark":
return R.id.drawer_bookmarks;
+ case "Internet Radio":
+ return R.id.drawer_internet_radio_stations;
case "Share":
return R.id.drawer_shares;
case "Chat":
diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
index ca6dd168..33b7d033 100644
--- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
+++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
@@ -66,6 +66,7 @@ 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.SelectInternetRadioStationFragment;
import github.daneren2005.dsub.fragments.SelectPlaylistFragment;
import github.daneren2005.dsub.fragments.SelectPodcastsFragment;
import github.daneren2005.dsub.fragments.SelectShareFragment;
@@ -662,6 +663,8 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
return new SelectPodcastsFragment();
} else if("Bookmark".equals(fragmentType)) {
return new SelectBookmarkFragment();
+ } else if("Internet Radio".equals(fragmentType)) {
+ return new SelectInternetRadioStationFragment();
} else if("Share".equals(fragmentType)) {
return new SelectShareFragment();
} else if("Admin".equals(fragmentType)) {
diff --git a/app/src/main/java/github/daneren2005/dsub/adapter/InternetRadioStationAdapter.java b/app/src/main/java/github/daneren2005/dsub/adapter/InternetRadioStationAdapter.java
new file mode 100644
index 00000000..9d47d70c
--- /dev/null
+++ b/app/src/main/java/github/daneren2005/dsub/adapter/InternetRadioStationAdapter.java
@@ -0,0 +1,56 @@
+/*
+ This file is part of Subsonic.
+ Subsonic is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+ Subsonic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
+ Copyright 2016 (C) Scott Jackson
+*/
+package github.daneren2005.dsub.adapter;
+
+import android.content.Context;
+import android.view.ViewGroup;
+
+import java.util.List;
+
+import github.daneren2005.dsub.domain.InternetRadioStation;
+import github.daneren2005.dsub.view.FastScroller;
+import github.daneren2005.dsub.view.InternetRadioStationView;
+import github.daneren2005.dsub.view.UpdateView;
+
+public class InternetRadioStationAdapter extends SectionAdapter<InternetRadioStation> implements FastScroller.BubbleTextGetter {
+ public static int VIEW_TYPE_INTERNET_RADIO_STATION = 1;
+
+ public InternetRadioStationAdapter(Context context, List<InternetRadioStation> stations, OnItemClickedListener listener) {
+ super(context, stations);
+ this.onItemClickedListener = listener;
+ }
+
+ @Override
+ public UpdateView.UpdateViewHolder onCreateSectionViewHolder(ViewGroup parent, int viewType) {
+ return new UpdateView.UpdateViewHolder(new InternetRadioStationView(context));
+ }
+
+ @Override
+ public void onBindViewHolder(UpdateView.UpdateViewHolder holder, InternetRadioStation station, int viewType) {
+ holder.getUpdateView().setObject(station);
+ holder.setItem(station);
+ }
+
+ @Override
+ public int getItemViewType(InternetRadioStation station) {
+ return VIEW_TYPE_INTERNET_RADIO_STATION;
+ }
+
+ @Override
+ public String getTextToShowInBubble(int position) {
+ InternetRadioStation item = getItemForPosition(position);
+ return item.getTitle();
+ }
+}
diff --git a/app/src/main/java/github/daneren2005/dsub/domain/InternetRadioStation.java b/app/src/main/java/github/daneren2005/dsub/domain/InternetRadioStation.java
new file mode 100644
index 00000000..47d79b99
--- /dev/null
+++ b/app/src/main/java/github/daneren2005/dsub/domain/InternetRadioStation.java
@@ -0,0 +1,43 @@
+/*
+ This file is part of Subsonic.
+
+ Subsonic is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Subsonic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright 2016 (C) Scott Jackson
+*/
+
+package github.daneren2005.dsub.domain;
+
+public class InternetRadioStation extends MusicDirectory.Entry {
+ private String streamUrl;
+ private String homePageUrl;
+
+ public InternetRadioStation() {}
+
+ public String getStreamUrl() {
+ return streamUrl;
+ }
+
+ public void setStreamUrl(String streamUrl) {
+ this.streamUrl = streamUrl;
+ }
+
+ public String getHomePageUrl() {
+ return homePageUrl;
+ }
+
+ public void setHomePageUrl(String homePageUrl) {
+ this.homePageUrl = homePageUrl;
+ }
+}
diff --git a/app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java b/app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java
index dd41bcac..e41a9503 100644
--- a/app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java
+++ b/app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java
@@ -216,6 +216,9 @@ public class ServerInfo implements Serializable {
public static boolean canBookmark(Context context) {
return checkServerVersion(context, "1.9");
}
+ public static boolean canInternetRadio(Context context) {
+ return checkServerVersion(context, "1.9");
+ }
public static boolean canSavePlayQueue(Context context) {
return ServerInfo.checkServerVersion(context, "1.12") && (!ServerInfo.isMadsonic(context) || checkServerVersion(context, "2.0"));
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SelectInternetRadioStationFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SelectInternetRadioStationFragment.java
new file mode 100644
index 00000000..94c0f1e2
--- /dev/null
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/SelectInternetRadioStationFragment.java
@@ -0,0 +1,94 @@
+/*
+ This file is part of Subsonic.
+
+ Subsonic is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Subsonic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright 2016 (C) Scott Jackson
+*/
+package github.daneren2005.dsub.fragments;
+
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import github.daneren2005.dsub.R;
+import github.daneren2005.dsub.adapter.InternetRadioStationAdapter;
+import github.daneren2005.dsub.adapter.SectionAdapter;
+import github.daneren2005.dsub.domain.InternetRadioStation;
+import github.daneren2005.dsub.service.MusicService;
+import github.daneren2005.dsub.util.ProgressListener;
+import github.daneren2005.dsub.util.Util;
+import github.daneren2005.dsub.view.UpdateView;
+
+public class SelectInternetRadioStationFragment extends SelectRecyclerFragment<InternetRadioStation> {
+ @Override
+ public int getOptionsMenu() {
+ return R.menu.abstract_top_menu;
+ }
+
+ @Override
+ public SectionAdapter<InternetRadioStation> getAdapter(List<InternetRadioStation> objs) {
+ return new InternetRadioStationAdapter(context, objs, this);
+ }
+
+ @Override
+ public List<InternetRadioStation> getObjects(MusicService musicService, boolean refresh, ProgressListener listener) throws Exception {
+ return musicService.getInternetRadioStations(refresh, context, listener);
+ }
+
+ @Override
+ public int getTitleResource() {
+ return R.string.button_bar_internet_radio;
+ }
+
+ @Override
+ public void onItemClicked(UpdateView<InternetRadioStation> updateView, InternetRadioStation item) {
+
+ }
+
+ @Override
+ public void onCreateContextMenu(Menu menu, MenuInflater menuInflater, UpdateView<InternetRadioStation> updateView, InternetRadioStation item) {
+ menuInflater.inflate(R.menu.select_internet_radio_context, menu);
+ }
+
+ @Override
+ public boolean onContextItemSelected(MenuItem menuItem, UpdateView<InternetRadioStation> updateView, InternetRadioStation item) {
+ switch (menuItem.getItemId()) {
+ case R.id.internet_radio_info:
+ displayInternetRadioStationInfo(item);
+ break;
+ }
+
+ return false;
+ }
+
+ private void displayInternetRadioStationInfo(final InternetRadioStation station) {
+ List<Integer> headers = new ArrayList<>();
+ List<String> details = new ArrayList<>();
+
+ headers.add(R.string.details_title);
+ details.add(station.getTitle());
+
+ headers.add(R.string.details_home_page);
+ details.add(station.getHomePageUrl());
+
+ headers.add(R.string.details_stream_url);
+ details.add(station.getStreamUrl());
+
+ Util.showDetailsDialog(context, R.string.details_title_internet_radio_station, headers, details);
+ }
+}
diff --git a/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java
index 1a17dfb3..00fb4624 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java
@@ -39,6 +39,7 @@ import github.daneren2005.dsub.domain.Bookmark;
import github.daneren2005.dsub.domain.ChatMessage;
import github.daneren2005.dsub.domain.Genre;
import github.daneren2005.dsub.domain.Indexes;
+import github.daneren2005.dsub.domain.InternetRadioStation;
import github.daneren2005.dsub.domain.PlayerQueue;
import github.daneren2005.dsub.domain.PodcastEpisode;
import github.daneren2005.dsub.domain.RemoteStatus;
@@ -1218,6 +1219,22 @@ public class CachedMusicService implements MusicService {
}
@Override
+ public List<InternetRadioStation> getInternetRadioStations(boolean refresh, Context context, ProgressListener progressListener) throws Exception {
+ List<InternetRadioStation> result = null;
+
+ if(!refresh) {
+ result = FileUtil.deserialize(context, getCacheName(context, "internetRadioStations"), ArrayList.class);
+ }
+
+ if(result == null) {
+ result = musicService.getInternetRadioStations(refresh, context, progressListener);
+ FileUtil.serialize(context, new ArrayList<>(result), getCacheName(context, "internetRadioStations"));
+ }
+
+ return result;
+ }
+
+ @Override
public int processOfflineSyncs(final Context context, final ProgressListener progressListener) throws Exception{
return musicService.processOfflineSyncs(context, progressListener);
}
diff --git a/app/src/main/java/github/daneren2005/dsub/service/MusicService.java b/app/src/main/java/github/daneren2005/dsub/service/MusicService.java
index 22f154c4..1e275108 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/MusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/MusicService.java
@@ -30,6 +30,7 @@ import github.daneren2005.dsub.domain.Bookmark;
import github.daneren2005.dsub.domain.ChatMessage;
import github.daneren2005.dsub.domain.Genre;
import github.daneren2005.dsub.domain.Indexes;
+import github.daneren2005.dsub.domain.InternetRadioStation;
import github.daneren2005.dsub.domain.PlayerQueue;
import github.daneren2005.dsub.domain.RemoteStatus;
import github.daneren2005.dsub.domain.Lyrics;
@@ -194,6 +195,8 @@ public interface MusicService {
void savePlayQueue(List<MusicDirectory.Entry> songs, MusicDirectory.Entry currentPlaying, int position, Context context, ProgressListener progressListener) throws Exception;
PlayerQueue getPlayQueue(Context context, ProgressListener progressListener) throws Exception;
+
+ List<InternetRadioStation> getInternetRadioStations(boolean refresh, Context context, ProgressListener progressListener) throws Exception;
int processOfflineSyncs(final Context context, final ProgressListener progressListener) throws Exception;
diff --git a/app/src/main/java/github/daneren2005/dsub/service/OfflineMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/OfflineMusicService.java
index e004101d..2c439ec4 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/OfflineMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/OfflineMusicService.java
@@ -41,6 +41,7 @@ import github.daneren2005.dsub.domain.ArtistInfo;
import github.daneren2005.dsub.domain.ChatMessage;
import github.daneren2005.dsub.domain.Genre;
import github.daneren2005.dsub.domain.Indexes;
+import github.daneren2005.dsub.domain.InternetRadioStation;
import github.daneren2005.dsub.domain.MusicDirectory.Entry;
import github.daneren2005.dsub.domain.PlayerQueue;
import github.daneren2005.dsub.domain.PodcastEpisode;
@@ -890,6 +891,11 @@ public class OfflineMusicService implements MusicService {
}
@Override
+ public List<InternetRadioStation> getInternetRadioStations(boolean refresh, Context context, ProgressListener progressListener) throws Exception {
+ throw new OfflineException(ERRORMSG);
+ }
+
+ @Override
public int processOfflineSyncs(final Context context, final ProgressListener progressListener) throws Exception{
throw new OfflineException(ERRORMSG);
}
diff --git a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
index 1f9e5494..6ccf562c 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
@@ -80,6 +80,7 @@ import github.daneren2005.dsub.service.parser.ChatMessageParser;
import github.daneren2005.dsub.service.parser.ErrorParser;
import github.daneren2005.dsub.service.parser.GenreParser;
import github.daneren2005.dsub.service.parser.IndexesParser;
+import github.daneren2005.dsub.service.parser.InternetRadioStationParser;
import github.daneren2005.dsub.service.parser.JukeboxStatusParser;
import github.daneren2005.dsub.service.parser.LicenseParser;
import github.daneren2005.dsub.service.parser.LyricsParser;
@@ -1765,6 +1766,18 @@ public class RESTMusicService implements MusicService {
}
@Override
+ public List<InternetRadioStation> getInternetRadioStations(boolean refresh, Context context, ProgressListener progressListener) throws Exception {
+ checkServerVersion(context, "1.9", null);
+
+ Reader reader = getReader(context, progressListener, "getInternetRadioStations", null);
+ try {
+ return new InternetRadioStationParser(context, getInstance(context)).parse(reader, progressListener);
+ } finally {
+ Util.close(reader);
+ }
+ }
+
+ @Override
public int processOfflineSyncs(final Context context, final ProgressListener progressListener) throws Exception{
return processOfflineScrobbles(context, progressListener) + processOfflineStars(context, progressListener);
}
diff --git a/app/src/main/java/github/daneren2005/dsub/service/parser/InternetRadioStationParser.java b/app/src/main/java/github/daneren2005/dsub/service/parser/InternetRadioStationParser.java
new file mode 100644
index 00000000..77d7bc4a
--- /dev/null
+++ b/app/src/main/java/github/daneren2005/dsub/service/parser/InternetRadioStationParser.java
@@ -0,0 +1,63 @@
+/*
+ This file is part of Subsonic.
+
+ Subsonic is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Subsonic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright 2016 (C) Scott Jackson
+*/
+package github.daneren2005.dsub.service.parser;
+
+import android.content.Context;
+import github.daneren2005.dsub.domain.InternetRadioStation;
+import github.daneren2005.dsub.util.ProgressListener;
+import org.xmlpull.v1.XmlPullParser;
+
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+
+public class InternetRadioStationParser extends ErrorParser {
+ public InternetRadioStationParser(Context context, int instance) {
+ super(context, instance);
+ }
+
+ public List<InternetRadioStation> parse(Reader reader, ProgressListener progressListener) throws Exception {
+ init(reader);
+
+ List<InternetRadioStation> result = new ArrayList<>();
+ int eventType;
+ do {
+ eventType = nextParseEvent();
+ if (eventType == XmlPullParser.START_TAG) {
+ String name = getElementName();
+ if ("internetRadioStation".equals(name)) {
+ InternetRadioStation station = new InternetRadioStation();
+
+ station.setId(get("id"));
+ station.setTitle(get("name"));
+ station.setStreamUrl(get("streamUrl"));
+ station.setHomePageUrl(get("homePageUrl"));
+
+ result.add(station);
+ } else if ("error".equals(name)) {
+ handleError();
+ }
+ }
+ } while (eventType != XmlPullParser.END_DOCUMENT);
+
+ validate();
+ return result;
+ }
+
+} \ No newline at end of file
diff --git a/app/src/main/java/github/daneren2005/dsub/util/Constants.java b/app/src/main/java/github/daneren2005/dsub/util/Constants.java
index 7fa05a2c..2d4301d9 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/Constants.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/Constants.java
@@ -134,6 +134,7 @@ public final class Constants {
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 PREFERENCES_KEY_INTERNET_RADIO_ENABLED = "internetRadioEnabled";
public static final String PREFERENCES_KEY_CUSTOM_SORT_ENABLED = "customSortEnabled";
public static final String PREFERENCES_KEY_MENU_PLAY_NOW = "showPlayNow";
public static final String PREFERENCES_KEY_MENU_PLAY_SHUFFLED = "showPlayShuffled";
diff --git a/app/src/main/java/github/daneren2005/dsub/view/InternetRadioStationView.java b/app/src/main/java/github/daneren2005/dsub/view/InternetRadioStationView.java
new file mode 100644
index 00000000..36aaa8af
--- /dev/null
+++ b/app/src/main/java/github/daneren2005/dsub/view/InternetRadioStationView.java
@@ -0,0 +1,39 @@
+/*
+ This file is part of Subsonic.
+ Subsonic is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+ Subsonic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
+ Copyright 2016 (C) Scott Jackson
+*/
+package github.daneren2005.dsub.view;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import github.daneren2005.dsub.R;
+import github.daneren2005.dsub.domain.InternetRadioStation;
+
+public class InternetRadioStationView extends UpdateView<InternetRadioStation> {
+ private TextView titleView;
+
+ public InternetRadioStationView(Context context) {
+ super(context);
+ LayoutInflater.from(context).inflate(R.layout.basic_list_item, this, true);
+
+ titleView = (TextView) findViewById(R.id.item_name);
+ moreButton = (ImageView) findViewById(R.id.item_more);
+ }
+
+ protected void setObjectImpl(InternetRadioStation station) {
+ titleView.setText(station.getTitle());
+ }
+}
diff --git a/app/src/main/res/menu/drawer_navigation.xml b/app/src/main/res/menu/drawer_navigation.xml
index bd309455..32de5cd5 100644
--- a/app/src/main/res/menu/drawer_navigation.xml
+++ b/app/src/main/res/menu/drawer_navigation.xml
@@ -22,6 +22,10 @@
android:icon="?attr/drawerBookmarks"
android:title="@string/button_bar.bookmarks"/>
<item
+ android:id="@+id/drawer_internet_radio_stations"
+ android:icon="?attr/drawerInternetRadioStations"
+ android:title="@string/button_bar.internet_radio"/>
+ <item
android:id="@+id/drawer_shares"
android:icon="?attr/drawerShares"
android:title="@string/button_bar.shares"/>
diff --git a/app/src/main/res/menu/select_internet_radio_context.xml b/app/src/main/res/menu/select_internet_radio_context.xml
new file mode 100644
index 00000000..e739aec5
--- /dev/null
+++ b/app/src/main/res/menu/select_internet_radio_context.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:id="@+id/internet_radio_info"
+ android:title="@string/common.info"/>
+
+</menu>
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index ee246d16..e9aadce7 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -6,6 +6,7 @@
<item>@string/button_bar.playlists</item>
<item>@string/button_bar.podcasts</item>
<item>@string/button_bar.bookmarks</item>
+ <item>@string/button_bar.internet_radio</item>
<item>@string/button_bar.shares</item>
<item>@string/button_bar.chat</item>
</string-array>
@@ -16,6 +17,7 @@
<item>Playlist</item>
<item>Podcast</item>
<item>Bookmark</item>
+ <item>Internet Radio</item>
<item>Share</item>
<item>Chat</item>
</string-array>
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
index 7cd447f0..055726b8 100644
--- a/app/src/main/res/values/attrs.xml
+++ b/app/src/main/res/values/attrs.xml
@@ -49,6 +49,7 @@
<attr name="drawerPlaylists" format="reference"/>
<attr name="drawerPodcasts" format="reference"/>
<attr name="drawerBookmarks" format="reference"/>
+ <attr name="drawerInternetRadioStations" format="reference"/>
<attr name="drawerShares" format="reference"/>
<attr name="drawerChat" format="reference"/>
<attr name="drawerAdmin" format="reference"/>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index c15a5d3e..9ac609c3 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -36,6 +36,7 @@
<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.internet_radio">Internet Radio</string>
<string name="button_bar.shares">Shares</string>
<string name="button_bar.chat">Chat</string>
<string name="button_bar.admin">Admin</string>
@@ -410,6 +411,8 @@
<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="settings.internet_radio_enabled">Internet Radio Enabled</string>
+ <string name="settings.internet_radio_enabled_summary">Whether or not to display the internet radio listing in the pull out drawer</string>
<string name="settings.shares_enabled">Shares Enabled</string>
<string name="settings.shares_enabled_summary">Whether or not to display the shares listing in the pull out drawer</string>
<string name="settings.sync_title">Sync</string>
@@ -610,6 +613,7 @@
<string name="details.title.podcast">Podcast Details</string>
<string name="details.title.playlist">Playlist Details</string>
<string name="details.title.artist">Artist Details</string>
+ <string name="details.title.internet_radio_station">Internet Radio Details</string>
<string name="details.podcast">Podcast</string>
<string name="details.status">Status</string>
<string name="details.artist">Artist</string>
@@ -649,6 +653,8 @@
<string name="details.last_played">Last Played</string>
<string name="details.expiration">Expiration</string>
<string name="details.played_count">Played Count</string>
+ <string name="details.stream_url">Stream URL</string>
+ <string name="details.home_page">Home Page</string>
<string name="permission.external_storage.failed">DSub cannot function without the ability to write to storage</string>
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index 9e95fe9d..8cccab93 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -49,6 +49,7 @@
<item name="drawerPlaylists">@drawable/ic_menu_playlist_light</item>
<item name="drawerPodcasts">@drawable/ic_menu_podcast_light</item>
<item name="drawerBookmarks">@drawable/ic_menu_bookmark_light</item>
+ <item name="drawerInternetRadioStations">@drawable/ic_menu_radio_light</item>
<item name="drawerShares">@drawable/ic_menu_share_light</item>
<item name="drawerChat">@drawable/ic_menu_chat_light</item>
<item name="drawerAdmin">@drawable/ic_menu_admin_light</item>
@@ -120,6 +121,7 @@
<item name="drawerPlaylists">@drawable/ic_menu_playlist_dark</item>
<item name="drawerPodcasts">@drawable/ic_menu_podcast_dark</item>
<item name="drawerBookmarks">@drawable/ic_menu_bookmark_dark</item>
+ <item name="drawerInternetRadioStations">@drawable/ic_menu_radio_dark</item>
<item name="drawerShares">@drawable/ic_menu_share_dark</item>
<item name="drawerChat">@drawable/ic_menu_chat_dark</item>
<item name="drawerAdmin">@drawable/ic_menu_admin_dark</item>
diff --git a/app/src/main/res/xml/settings_drawer.xml b/app/src/main/res/xml/settings_drawer.xml
index 4b92737e..21ec1586 100644
--- a/app/src/main/res/xml/settings_drawer.xml
+++ b/app/src/main/res/xml/settings_drawer.xml
@@ -19,6 +19,12 @@
android:defaultValue="true"/>
<CheckBoxPreference
+ android:title="@string/settings.internet_radio_enabled"
+ android:summary="@string/settings.internet_radio_enabled_summary"
+ android:key="internetRadioEnabled"
+ android:defaultValue="true"/>
+
+ <CheckBoxPreference
android:title="@string/settings.shares_enabled"
android:summary="@string/settings.shares_enabled_summary"
android:key="sharedEnabled"