public void onListItemClick(ListView l, View v, int position, long id) {
    final Album a = albums.get(position);
    Log.d(getPackageName(), "Selected Album: " + a);

    Intent i = new Intent(this, SongsActivity.class);
    i.putExtra("album", a.getTitle());
    i.putExtra("album_id", a.getId());
    i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
    startActivity(i);
  }
  @Override
  protected void updateNowPlaying(Song currentSong, boolean animate) {
    super.updateNowPlaying(currentSong, animate);

    for (Album a : albums) {
      if (currentSong != null && a.getId() == currentSong.getAlbum_id()) {
        a.setPlaying(true);
        Log.d(getPackageName(), a.getTitle() + " found");
      } else {
        a.setPlaying(false);
      }
    }

    aa.notifyDataSetChanged();
  }
Beispiel #3
0
  public Album(Context ctx, int id, String title, String artist, int total) {
    this(id, title, artist, total);

    Bitmap aa = Album.getArtwork(ctx, -1, id, false);
    Bitmap aaUnknown =
        BitmapFactory.decodeResource(ctx.getResources(), R.drawable.albumart_mp_unknown_list);
    if (aa == null) {
      aa = aaUnknown;
    } else {
      Bitmap b =
          Bitmap.createBitmap(aaUnknown.getWidth(), aaUnknown.getHeight(), Bitmap.Config.RGB_565);
      Canvas canvas = new Canvas(b);
      canvas.drawARGB(255, 0, 255, 0);
      Rect src = new Rect(0, 0, aa.getWidth(), aa.getHeight());
      Rect dst = new Rect(0, 0, aaUnknown.getWidth(), aaUnknown.getHeight());
      canvas.drawBitmap(aa, src, dst, new Paint());
      aa = b;
    }

    albumArt = new BitmapDrawable(ctx.getResources(), aa);
    albumArt.setFilterBitmap(false);
    albumArt.setDither(false);
  }