aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-07-31 18:30:47 -0700
committerScott Jackson <daneren2005@gmail.com>2013-07-31 18:30:47 -0700
commit4a1c24cc6ca4c45552fc0a8eb6ebe6e03d3259b6 (patch)
treef66a2f6a4d08eeae224c5d177e9d400a7773b2bc /src
parent7b1c0bad8fd7c0cf4a0a770a8ecd24d4bf02a1a5 (diff)
downloaddsub-4a1c24cc6ca4c45552fc0a8eb6ebe6e03d3259b6.tar.gz
dsub-4a1c24cc6ca4c45552fc0a8eb6ebe6e03d3259b6.tar.bz2
dsub-4a1c24cc6ca4c45552fc0a8eb6ebe6e03d3259b6.zip
Update UpdateView abstraction
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/fragments/DownloadFragment.java2
-rw-r--r--src/github/daneren2005/dsub/view/AlbumView.java6
-rw-r--r--src/github/daneren2005/dsub/view/ArtistAdapter.java2
-rw-r--r--src/github/daneren2005/dsub/view/EntryAdapter.java6
-rw-r--r--src/github/daneren2005/dsub/view/GenreAdapter.java2
-rw-r--r--src/github/daneren2005/dsub/view/GenreView.java2
-rw-r--r--src/github/daneren2005/dsub/view/PlaylistAdapter.java2
-rw-r--r--src/github/daneren2005/dsub/view/PlaylistView.java2
-rw-r--r--src/github/daneren2005/dsub/view/PodcastChannelAdapter.java2
-rw-r--r--src/github/daneren2005/dsub/view/PodcastChannelView.java3
-rw-r--r--src/github/daneren2005/dsub/view/SongView.java12
-rw-r--r--src/github/daneren2005/dsub/view/UpdateView.java13
12 files changed, 32 insertions, 22 deletions
diff --git a/src/github/daneren2005/dsub/fragments/DownloadFragment.java b/src/github/daneren2005/dsub/fragments/DownloadFragment.java
index 56accc30..94c2a02a 100644
--- a/src/github/daneren2005/dsub/fragments/DownloadFragment.java
+++ b/src/github/daneren2005/dsub/fragments/DownloadFragment.java
@@ -1081,7 +1081,7 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe
view = new SongView(context);
}
DownloadFile downloadFile = getItem(position);
- view.setSong(downloadFile.getSong(), false);
+ view.setObject(downloadFile.getSong(), false);
return view;
}
}
diff --git a/src/github/daneren2005/dsub/view/AlbumView.java b/src/github/daneren2005/dsub/view/AlbumView.java
index 4d4e5f99..4c92f17a 100644
--- a/src/github/daneren2005/dsub/view/AlbumView.java
+++ b/src/github/daneren2005/dsub/view/AlbumView.java
@@ -65,12 +65,12 @@ public class AlbumView extends UpdateView {
});
}
- protected void setObjectImpl(Object obj) {
- this.album = (MusicDirectory.Entry) obj;
+ protected void setObjectImpl(Object obj1, Object obj2) {
+ this.album = (MusicDirectory.Entry) obj1;
titleView.setText(album.getTitle());
artistView.setText(album.getArtist());
artistView.setVisibility(album.getArtist() == null ? View.GONE : View.VISIBLE);
- imageLoader.loadImage(coverArtView, album, false, true);
+ ((ImageLoader)obj2).loadImage(coverArtView, album, false, true);
file = FileUtil.getAlbumDirectory(context, album);
}
diff --git a/src/github/daneren2005/dsub/view/ArtistAdapter.java b/src/github/daneren2005/dsub/view/ArtistAdapter.java
index 7e9bf218..ff66f396 100644
--- a/src/github/daneren2005/dsub/view/ArtistAdapter.java
+++ b/src/github/daneren2005/dsub/view/ArtistAdapter.java
@@ -68,7 +68,7 @@ public class ArtistAdapter extends ArrayAdapter<Artist> implements SectionIndexe
} else {
view = new ArtistView(activity);
}
- view.setArtist(entry);
+ view.setObject(entry);
return view;
}
diff --git a/src/github/daneren2005/dsub/view/EntryAdapter.java b/src/github/daneren2005/dsub/view/EntryAdapter.java
index ff7393c6..22ca384c 100644
--- a/src/github/daneren2005/dsub/view/EntryAdapter.java
+++ b/src/github/daneren2005/dsub/view/EntryAdapter.java
@@ -58,11 +58,11 @@ public class EntryAdapter extends ArrayAdapter<MusicDirectory.Entry> {
if(entry.getArtist() != null || entry.getParent() != null) {
AlbumView view;
view = new AlbumView(activity);
- view.setAlbum(entry, imageLoader);
+ view.setObject(entry, imageLoader);
return view;
} else {
ArtistEntryView view = new ArtistEntryView(activity);
- view.setArtist(entry);
+ view.setObject(entry);
return view;
}
} else {
@@ -72,7 +72,7 @@ public class EntryAdapter extends ArrayAdapter<MusicDirectory.Entry> {
} else {
view = new SongView(activity);
}
- view.setSong(entry, checkable);
+ view.setObject(entry, checkable);
return view;
}
}
diff --git a/src/github/daneren2005/dsub/view/GenreAdapter.java b/src/github/daneren2005/dsub/view/GenreAdapter.java
index b98efd20..05cc0da9 100644
--- a/src/github/daneren2005/dsub/view/GenreAdapter.java
+++ b/src/github/daneren2005/dsub/view/GenreAdapter.java
@@ -53,7 +53,7 @@ public class GenreAdapter extends ArrayAdapter<Genre>{
} else {
view = new GenreView(activity);
}
- view.setGenre(genre);
+ view.setObject(genre);
return view;
}
}
diff --git a/src/github/daneren2005/dsub/view/GenreView.java b/src/github/daneren2005/dsub/view/GenreView.java
index affcd701..934a63bd 100644
--- a/src/github/daneren2005/dsub/view/GenreView.java
+++ b/src/github/daneren2005/dsub/view/GenreView.java
@@ -43,6 +43,6 @@ public class GenreView extends UpdateView {
}
public void setObjectImpl(Object obj) {
- titleView.setText(((Genre)genre).getName());
+ titleView.setText(((Genre)obj).getName());
}
}
diff --git a/src/github/daneren2005/dsub/view/PlaylistAdapter.java b/src/github/daneren2005/dsub/view/PlaylistAdapter.java
index 71727c04..f25996dd 100644
--- a/src/github/daneren2005/dsub/view/PlaylistAdapter.java
+++ b/src/github/daneren2005/dsub/view/PlaylistAdapter.java
@@ -49,7 +49,7 @@ public class PlaylistAdapter extends ArrayAdapter<Playlist> {
} else {
view = new PlaylistView(activity);
}
- view.setPlaylist(entry);
+ view.setObject(entry);
return view;
}
diff --git a/src/github/daneren2005/dsub/view/PlaylistView.java b/src/github/daneren2005/dsub/view/PlaylistView.java
index ad8f2730..31332b22 100644
--- a/src/github/daneren2005/dsub/view/PlaylistView.java
+++ b/src/github/daneren2005/dsub/view/PlaylistView.java
@@ -58,7 +58,7 @@ public class PlaylistView extends UpdateView {
}
protected void setObjectImpl(Object obj) {
- this.playlist = (Playlist) playlist;
+ this.playlist = (Playlist) obj;
titleView.setText(playlist.getName());
file = FileUtil.getPlaylistFile(Util.getServerName(context), playlist.getName());
}
diff --git a/src/github/daneren2005/dsub/view/PodcastChannelAdapter.java b/src/github/daneren2005/dsub/view/PodcastChannelAdapter.java
index 6b7af991..3a7ab922 100644
--- a/src/github/daneren2005/dsub/view/PodcastChannelAdapter.java
+++ b/src/github/daneren2005/dsub/view/PodcastChannelAdapter.java
@@ -53,7 +53,7 @@ public class PodcastChannelAdapter extends ArrayAdapter<PodcastChannel>{
} else {
view = new PodcastChannelView(activity);
}
- view.setPodcastChannel(podcast);
+ view.setObject(podcast);
return view;
}
}
diff --git a/src/github/daneren2005/dsub/view/PodcastChannelView.java b/src/github/daneren2005/dsub/view/PodcastChannelView.java
index 8d4c932d..2998c16d 100644
--- a/src/github/daneren2005/dsub/view/PodcastChannelView.java
+++ b/src/github/daneren2005/dsub/view/PodcastChannelView.java
@@ -34,6 +34,7 @@ public class PodcastChannelView extends UpdateView {
private Context context;
private PodcastChannel channel;
+ private File file;
private TextView titleView;
@@ -43,7 +44,7 @@ public class PodcastChannelView extends UpdateView {
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 = (ImageButton) findViewById(R.id.artist_star);
moreButton = (ImageView) findViewById(R.id.artist_more);
moreButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
diff --git a/src/github/daneren2005/dsub/view/SongView.java b/src/github/daneren2005/dsub/view/SongView.java
index 042d8031..fb3e171e 100644
--- a/src/github/daneren2005/dsub/view/SongView.java
+++ b/src/github/daneren2005/dsub/view/SongView.java
@@ -51,8 +51,6 @@ public class SongView extends UpdateView implements Checkable {
private TextView artistTextView;
private TextView durationTextView;
private TextView statusTextView;
- private ImageButton starButton;
- private ImageView moreButton;
private DownloadService downloadService;
private long revision = -1;
@@ -61,7 +59,6 @@ public class SongView extends UpdateView implements Checkable {
private boolean playing = false;
private int rightImage = 0;
private int moreImage = 0;
- private boolean starred = false;
private boolean isWorkDone = false;
private boolean isSaved = false;
private File partialFile;
@@ -78,7 +75,6 @@ public class SongView extends UpdateView implements Checkable {
durationTextView = (TextView) findViewById(R.id.song_duration);
statusTextView = (TextView) findViewById(R.id.song_status);
starButton = (ImageButton) findViewById(R.id.song_star);
- starButton.setFocusable(false);
moreButton = (ImageView) findViewById(R.id.artist_more);
moreButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
@@ -87,8 +83,9 @@ public class SongView extends UpdateView implements Checkable {
});
}
- public void setSong(MusicDirectory.Entry song, boolean checkable) {
- this.song = song;
+ public void setObjectImpl(Object obj1, Object obj2) {
+ this.song = (MusicDirectory.Entry) obj1;
+ boolean checkable = (Boolean) obj2;
StringBuilder artist = new StringBuilder(40);
@@ -144,8 +141,6 @@ public class SongView extends UpdateView implements Checkable {
checkedTextView.setVisibility(checkable && !song.isVideo() ? View.VISIBLE : View.GONE);
revision = -1;
- updateBackground();
- update();
}
@Override
@@ -167,6 +162,7 @@ public class SongView extends UpdateView implements Checkable {
isSaved = downloadFile.isSaved();
partialFile = downloadFile.getPartialFile();
partialFileExists = partialFile.exists();
+ isStarred = song.isStarred();
}
@Override
diff --git a/src/github/daneren2005/dsub/view/UpdateView.java b/src/github/daneren2005/dsub/view/UpdateView.java
index ced92ad6..c73ba72c 100644
--- a/src/github/daneren2005/dsub/view/UpdateView.java
+++ b/src/github/daneren2005/dsub/view/UpdateView.java
@@ -22,13 +22,18 @@ import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
+import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
+import android.widget.ImageButton;
+import android.widget.ImageView;
import android.widget.LinearLayout;
import java.util.ArrayList;
import java.util.List;
import java.util.WeakHashMap;
+import github.daneren2005.dsub.R;
+
public class UpdateView extends LinearLayout {
private static final String TAG = UpdateView.class.getSimpleName();
private static final WeakHashMap<UpdateView, ?> INSTANCES = new WeakHashMap<UpdateView, Object>();
@@ -66,9 +71,17 @@ public class UpdateView extends LinearLayout {
updateBackground();
update();
}
+ public void setObject(Object obj1, Object obj2) {
+ setObjectImpl(obj1, obj2);
+ updateBackground();
+ update();
+ }
protected void setObjectImpl(Object obj) {
}
+ protected void setObjectImpl(Object obj1, Object obj2) {
+
+ }
private static synchronized void startUpdater() {
if(uiHandler != null) {