예제 #1
0
  public void updated(final Instance instance) {
    if (!Player.Slides.PLAYLIST.equals(listActivity.getCurrSlide())) {
      return;
    }

    Instance instanceToAdd =
        instance.accept(
            new InstanceVisitor<Instance>() {
              public Instance visit(Track track) {
                if (getFilter().accept(new MatchFilterVisitor<Track, Tables.Tracks>(track))) {
                  switch (currMode) {
                    case Album:
                      return track.GetAlbum() == AlbumDigest.NO_ALBUM ? track : track.GetAlbum();
                    case Artist:
                      return track.GetArtist() == ArtistDigest.NO_ARTIST
                          ? track
                          : track.GetArtist();
                    case Genre:
                      return track.GetGenre() == GenreDigest.NO_GENRE ? track : track.GetGenre();
                    case Track:
                      return track;
                    case Dir:
                      return track;
                    default:
                      throw new RuntimeException(currMode.name() + " not expexted here");
                  }
                }
                return null;
              }

              public Instance visit(SongDigest track) {
                throw new RuntimeException("not supported yet");
              }

              public Instance visit(Album album) {
                throw new RuntimeException("not supported yet");
              }

              public Instance visit(GenreDigest genre) {
                throw new RuntimeException("not supported yet");
              }

              public Instance visit(ArtistDigest artist) {
                throw new RuntimeException("not supported yet");
              }

              public Instance visit(FSobject dir) {
                return getDirFilter().accept(new MatchFilterVisitor<FSobject, Tables.Dirs>(dir))
                        && Mode.Dir.equals(currMode)
                    ? dir
                    : null;
              }
            });

    if (instanceToAdd != null) {
      listAdapter.add(instanceToAdd);
    }
  }
예제 #2
0
 public void cleared() {
   listAdapter.clear();
 }