~ubuntuone-client-engineering/ubuntuone-android-music/metadata-caching-optimisation

« back to all changes in this revision

Viewing changes to src/com/ubuntuone/android/music/adapter/holder/NowPlayingViewHolder.java

  • Committer: Michał Karnicki
  • Date: 2012-11-08 14:14:54 UTC
  • Revision ID: michal.karnicki@canonical.com-20121108141454-e8yrgk6ylb00jobj
Added MusicService.
Added PlayerActivity.
Added NowPlaying view.
Added starring.
Wire UI multiple UI elements.
Added context menus, where applicable.
Minor theming.
Updated license headers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Ubuntu One Music - stream music from Ubuntu One cloud storage.
 
3
 * 
 
4
 * Copyright 2012 Canonical Ltd.
 
5
 * 
 
6
 * This file is part of Ubuntu One Music app.
 
7
 * 
 
8
 * This program is free software: you can redistribute it and/or modify
 
9
 * it under the terms of the GNU Affero General Public License as
 
10
 * published by the Free Software Foundation, either version 3 of the
 
11
 * License, or (at your option) any later version.
 
12
 * 
 
13
 * This program is distributed in the hope that it will be useful,
 
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
 * GNU Affero General Public License for more details.
 
17
 * 
 
18
 * You should have received a copy of the GNU Affero General Public License
 
19
 * along with this program.  If not, see http://www.gnu.org/licenses 
 
20
 */
 
21
 
 
22
package com.ubuntuone.android.music.adapter.holder;
 
23
 
 
24
import android.view.View;
 
25
import android.widget.ImageView;
 
26
import android.widget.TextView;
 
27
 
 
28
import com.ubuntuone.android.music.R;
 
29
import com.ubuntuone.android.music.util.U1ImageDownloader;
 
30
 
 
31
public class NowPlayingViewHolder
 
32
{
 
33
        public View nowPlaying;
 
34
        public ImageView albumArt;
 
35
        public TextView songTitle;
 
36
        public TextView songArtist;
 
37
        
 
38
        public NowPlayingViewHolder(View contentView) {
 
39
                nowPlaying = contentView;
 
40
                albumArt = (ImageView) contentView.findViewById(R.id.ab_album_art);
 
41
                songTitle = (TextView) contentView.findViewById(R.id.ab_song);
 
42
                songArtist = (TextView) contentView.findViewById(R.id.ab_artist);
 
43
        }
 
44
        
 
45
        public void bindView(String title, String artist, String albumId,
 
46
                        U1ImageDownloader imageDownloader) {
 
47
                songTitle.setText(title);
 
48
                songArtist.setText(artist);
 
49
                if (albumId != null) {
 
50
                        imageDownloader.getArt(albumId, albumArt);
 
51
                }
 
52
                nowPlaying.setVisibility(title != null ? View.VISIBLE : View.INVISIBLE);
 
53
        }
 
54
}