aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-07-09 21:46:04 -0700
committerScott Jackson <daneren2005@gmail.com>2013-07-09 21:46:04 -0700
commit5b15bbbd63e77d2a5e82cb20dcc9ff46fea1bf49 (patch)
tree6600a49167fdeb6cace0ec2164c2354186bff602 /subsonic-android/src
parenta3649fb9eb64602fc676a9ec3b93733e631dab13 (diff)
downloaddsub-5b15bbbd63e77d2a5e82cb20dcc9ff46fea1bf49.tar.gz
dsub-5b15bbbd63e77d2a5e82cb20dcc9ff46fea1bf49.tar.bz2
dsub-5b15bbbd63e77d2a5e82cb20dcc9ff46fea1bf49.zip
Make podcast channels arrow shaded based on whether any episodes are downloaded
Diffstat (limited to 'subsonic-android/src')
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/util/FileUtil.java6
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/view/PodcastChannelView.java20
2 files changed, 25 insertions, 1 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/util/FileUtil.java b/subsonic-android/src/github/daneren2005/dsub/util/FileUtil.java
index e63b3d76..267db36c 100644
--- a/subsonic-android/src/github/daneren2005/dsub/util/FileUtil.java
+++ b/subsonic-android/src/github/daneren2005/dsub/util/FileUtil.java
@@ -37,6 +37,7 @@ import android.os.Environment;
import android.util.Log;
import github.daneren2005.dsub.domain.Artist;
import github.daneren2005.dsub.domain.MusicDirectory;
+import github.daneren2005.dsub.domain.PodcastChannel;
/**
* @author Sindre Mehus
@@ -150,6 +151,11 @@ public class FileUtil {
}
return dir;
}
+
+ public static File getPodcastDirectory(Context context, PodcastChannel channel) {
+ File dir = new File(getMusicDirectory(context).getPath() + "/" + fileSystemSafe(channel.getName()));
+ return dir;
+ }
public static void createDirectoryForParent(File file) {
File dir = file.getParentFile();
diff --git a/subsonic-android/src/github/daneren2005/dsub/view/PodcastChannelView.java b/subsonic-android/src/github/daneren2005/dsub/view/PodcastChannelView.java
index 926ba1ba..b51eefb2 100644
--- a/subsonic-android/src/github/daneren2005/dsub/view/PodcastChannelView.java
+++ b/subsonic-android/src/github/daneren2005/dsub/view/PodcastChannelView.java
@@ -26,21 +26,28 @@ import android.widget.ImageView;
import android.widget.TextView;
import github.daneren2005.dsub.R;
import github.daneren2005.dsub.domain.PodcastChannel;
+import github.daneren2005.dsub.util.FileUtil;
+import java.io.File;
public class PodcastChannelView extends UpdateView {
private static final String TAG = PodcastChannelView.class.getSimpleName();
+ private Context context;
+ private PodcastChannel channel;
+
private TextView titleView;
+ private ImageView moreButton;
public PodcastChannelView(Context context) {
super(context);
+ this.context = context;
LayoutInflater.from(context).inflate(R.layout.artist_list_item, this, true);
titleView = (TextView) findViewById(R.id.artist_name);
ImageButton starButton = (ImageButton) findViewById(R.id.artist_star);
starButton.setVisibility(View.GONE);
starButton.setFocusable(false);
- ImageView moreButton = (ImageView) findViewById(R.id.artist_more);
+ moreButton = (ImageView) findViewById(R.id.artist_more);
moreButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
v.showContextMenu();
@@ -49,6 +56,17 @@ public class PodcastChannelView extends UpdateView {
}
public void setPodcastChannel(PodcastChannel podcastChannel) {
+ channel = podcastChannel;
titleView.setText(podcastChannel.getName());
}
+
+ @Override
+ protected void update() {
+ File file = FileUtil.getPodcastDirectory(context, channel);
+ if(file.exists()) {
+ moreButton.setImageResource(R.drawable.list_item_more_shaded);
+ } else {
+ moreButton.setImageResource(R.drawable.list_item_more);
+ }
+ }
}