Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. private final int[] songID = { R.raw.aaa, R.raw.bbb, R.raw.ccc};
  2.  
  3. private List<ProductLight> songList = new ArrayList<ProductLight>();
  4.  
  5. ProductLight product1 = new ProductLight(1,"One");
  6. ProductLight product2 = new ProductLight(2,"Two");
  7. ProductLight product3 = new ProductLight(3, "Three");
  8.  
  9. songList = new ArrayList<ProductLight>();
  10. songList.add(product1);
  11. songList.add(product2);
  12. songList.add(product3);
  13.  
  14. @Override
  15. public boolean favOnClick(int position , View v) {
  16. ProductLight product = songList.get(position);
  17. ImageView button = (ImageView) v.findViewById(R.id.favImageHive);
  18. String tag = button.getTag().toString();
  19. if (tag.equalsIgnoreCase("grey")) {
  20. sharedPreference.addFavorite(product);
  21. snackS("Added to Favorites");
  22. button.setTag("red");
  23. button.setImageResource(R.mipmap.bookmarked);
  24. } else {
  25. sharedPreference.removeFavorite(product);
  26. button.setTag("grey");
  27. button.setImageResource(R.mipmap.bookmark_border);
  28. snackS("Removed from Favorites");
  29. }
  30.  
  31. return true;
  32. }
  33.  
  34. private final int[] songID = { R.raw.aaa, R.raw.bbb, R.raw.ccc};
  35.  
  36. private List<ProductLight> songList = new ArrayList<ProductLight>();
  37.  
  38. songList = sharedPreference.getFavorites();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement