Ejemplo n.º 1
0
 public void fillView(int id) {
   switch (id) {
     case PlaylistsFragment.CREATE_PLAYLIST_BUTTON_ID:
       View v = mRootView.findViewById(R.id.imageview_grid_one);
       if (v != null) {
         v.setVisibility(View.GONE);
       }
       v = mRootView.findViewById(R.id.imageview_grid_two);
       if (v != null) {
         v.setVisibility(View.GONE);
       }
       v = mRootView.findViewById(R.id.imageview_grid_three);
       if (v != null) {
         v.setVisibility(View.GONE);
       }
       TomahawkUtils.ensureInflation(
           mRootView, R.id.imageview_create_playlist_stub, R.id.imageview_create_playlist);
       findViewById(R.id.imageview_create_playlist).setVisibility(View.VISIBLE);
       TextView textView1 = (TextView) findViewById(R.id.textview1);
       textView1.setText(
           TomahawkApp.getContext().getString(R.string.create_playlist).toUpperCase());
       TextView textView2 = (TextView) findViewById(R.id.textview2);
       textView2.setVisibility(View.GONE);
       TextView textView3 = (TextView) findViewById(R.id.textview3);
       textView3.setVisibility(View.GONE);
       break;
   }
 }
Ejemplo n.º 2
0
 public View ensureInflation(int stubResId, int inflatedId) {
   return TomahawkUtils.ensureInflation(mRootView, stubResId, inflatedId);
 }
Ejemplo n.º 3
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;
   }
 }