Ejemplo n.º 1
0
 public void fillView(Artist artist) {
   TextView textView1 = (TextView) findViewById(R.id.textview1);
   textView1.setText(artist.getPrettyName());
   ImageView imageView1 = (ImageView) findViewById(R.id.imageview1);
   TomahawkUtils.loadImageIntoImageView(
       TomahawkApp.getContext(), imageView1, artist.getImage(), Image.getSmallImageSize(), true);
 }
Ejemplo n.º 2
0
 public void fillView(final Album album, Collection collection) {
   if (collection == null) {
     collection = CollectionManager.getInstance().getCollection(TomahawkApp.PLUGINNAME_HATCHET);
   }
   TextView textView1 = (TextView) findViewById(R.id.textview1);
   textView1.setText(album.getPrettyName());
   TextView textView2 = (TextView) findViewById(R.id.textview2);
   textView2.setText(album.getArtist().getPrettyName());
   ImageView imageView1 = (ImageView) findViewById(R.id.imageview1);
   TomahawkUtils.loadImageIntoImageView(
       TomahawkApp.getContext(), imageView1, album.getImage(), Image.getSmallImageSize(), false);
   final TextView textView3 = (TextView) findViewById(R.id.textview3);
   textView3.setVisibility(View.INVISIBLE);
   collection
       .getAlbumTracks(album)
       .done(
           new DoneCallback<CollectionCursor<Query>>() {
             @Override
             public void onDone(CollectionCursor<Query> cursor) {
               int size = 0;
               if (cursor != null) {
                 size = cursor.size();
                 cursor.close();
               }
               textView3.setVisibility(View.VISIBLE);
               textView3.setText(
                   TomahawkApp.getContext()
                       .getResources()
                       .getQuantityString(R.plurals.songs_with_count, size, size));
             }
           });
 }
Ejemplo n.º 3
0
 public void fillView(User user) {
   TextView textView1 = (TextView) findViewById(R.id.textview1);
   textView1.setText(user.getName());
   if (mLayoutId == R.layout.list_item_user) {
     TextView textView2 = (TextView) findViewById(R.id.textview2);
     textView2.setText(
         TomahawkApp.getContext()
             .getString(
                 R.string.followers_count, user.getFollowersCount(), user.getFollowCount()));
   }
   TextView userTextView1 = (TextView) findViewById(R.id.usertextview1);
   ImageView userImageView1 = (ImageView) findViewById(R.id.userimageview1);
   TomahawkUtils.loadUserImageIntoImageView(
       TomahawkApp.getContext(), userImageView1, user, Image.getSmallImageSize(), userTextView1);
 }
Ejemplo n.º 4
0
 public void fillHeaderView(SocialAction socialAction, int segmentSize) {
   ImageView userImageView1 = (ImageView) findViewById(R.id.userimageview1);
   TextView userTextView = (TextView) findViewById(R.id.usertextview1);
   TomahawkUtils.loadUserImageIntoImageView(
       TomahawkApp.getContext(),
       userImageView1,
       socialAction.getUser(),
       Image.getSmallImageSize(),
       userTextView);
   Object targetObject = socialAction.getTargetObject();
   Resources resources = TomahawkApp.getContext().getResources();
   String userName = socialAction.getUser().getName();
   String phrase =
       "!FIXME! type: "
           + socialAction.getType()
           + ", action: "
           + socialAction.getAction()
           + ", user: "******":");
 }
Ejemplo n.º 5
0
 private static void fillView(
     View view, List<Image> artistImages, int height, boolean isPagerFragment) {
   View v;
   int gridOneResId = isPagerFragment ? R.id.imageview_grid_one_pager : R.id.imageview_grid_one;
   int gridTwoResId = isPagerFragment ? R.id.imageview_grid_two_pager : R.id.imageview_grid_two;
   int gridThreeResId =
       isPagerFragment ? R.id.imageview_grid_three_pager : R.id.imageview_grid_three;
   int gridOneStubId =
       isPagerFragment ? R.id.imageview_grid_one_pager_stub : R.id.imageview_grid_one_stub;
   int gridTwoStubId =
       isPagerFragment ? R.id.imageview_grid_two_pager_stub : R.id.imageview_grid_two_stub;
   int gridThreeStubId =
       isPagerFragment ? R.id.imageview_grid_three_pager_stub : R.id.imageview_grid_three_stub;
   if (artistImages.size() > 2) {
     v = view.findViewById(gridOneResId);
     if (v != null) {
       v.setVisibility(View.GONE);
     }
     v = view.findViewById(gridTwoResId);
     if (v != null) {
       v.setVisibility(View.GONE);
     }
     v = TomahawkUtils.ensureInflation(view, gridThreeStubId, gridThreeResId);
     v.setVisibility(View.VISIBLE);
     TomahawkUtils.loadImageIntoImageView(
         TomahawkApp.getContext(),
         (ImageView) v.findViewById(R.id.imageview1),
         artistImages.get(0),
         Image.getLargeImageSize(),
         false);
     TomahawkUtils.loadImageIntoImageView(
         TomahawkApp.getContext(),
         (ImageView) v.findViewById(R.id.imageview2),
         artistImages.get(1),
         Image.getSmallImageSize(),
         false);
     TomahawkUtils.loadImageIntoImageView(
         TomahawkApp.getContext(),
         (ImageView) v.findViewById(R.id.imageview3),
         artistImages.get(2),
         Image.getSmallImageSize(),
         false);
   } else if (artistImages.size() > 1) {
     v = view.findViewById(gridOneResId);
     if (v != null) {
       v.setVisibility(View.GONE);
     }
     v = view.findViewById(gridThreeResId);
     if (v != null) {
       v.setVisibility(View.GONE);
     }
     v = TomahawkUtils.ensureInflation(view, gridTwoStubId, gridTwoResId);
     v.setVisibility(View.VISIBLE);
     TomahawkUtils.loadImageIntoImageView(
         TomahawkApp.getContext(),
         (ImageView) v.findViewById(R.id.imageview1),
         artistImages.get(0),
         Image.getLargeImageSize(),
         false);
     TomahawkUtils.loadImageIntoImageView(
         TomahawkApp.getContext(),
         (ImageView) v.findViewById(R.id.imageview2),
         artistImages.get(1),
         Image.getSmallImageSize(),
         false);
   } else {
     v = view.findViewById(gridTwoResId);
     if (v != null) {
       v.setVisibility(View.GONE);
     }
     v = view.findViewById(gridThreeResId);
     if (v != null) {
       v.setVisibility(View.GONE);
     }
     v = TomahawkUtils.ensureInflation(view, gridOneStubId, gridOneResId);
     v.setVisibility(View.VISIBLE);
     if (artistImages.size() > 0) {
       TomahawkUtils.loadImageIntoImageView(
           TomahawkApp.getContext(),
           (ImageView) v.findViewById(R.id.imageview1),
           artistImages.get(0),
           Image.getLargeImageSize(),
           false);
     } else {
       TomahawkUtils.loadDrawableIntoImageView(
           TomahawkApp.getContext(),
           (ImageView) v.findViewById(R.id.imageview1),
           R.drawable.album_placeholder_grid);
     }
   }
   if (height > 0) {
     v.getLayoutParams().height = height;
   }
 }