Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. prevQuoteButton.setOnClickListener(new View.OnClickListener() {
  2. @Override
  3. public void onClick(View view) {
  4. /* Snackbar.make(view, "Previous Quote", Snackbar.LENGTH_LONG)
  5. .setAction("Action", null).show();*/
  6. if(prevIndex != 0) {
  7. prevIndex--;
  8. previousQuoteHelper(prevIndex);
  9. }
  10. else {
  11. Toast.makeText(MainActivity.this, "Get a new Quote!", Toast.LENGTH_SHORT).show();
  12. }
  13.  
  14. }
  15. });
  16.  
  17. /*
  18. * Helper method for previous quote button
  19. * @param prevIndex
  20. */
  21. public void previousQuoteHelper(int prevIndex) {
  22. currentQuote = quoteList.get(prevIndex);
  23. quoteTextView.setText(currentQuote.getQuote() +"n"+ currentQuote.getAuthor());
  24. if(currentQuote.isFave()) {
  25. //set action bar icon to red
  26. }
  27. else {
  28. //change action bar icon to white
  29. }
  30. // isPreviousQuote = true;
  31. Log.v("PREVIOUS:", prevIndex +" "+ currentQuote.getQuote() +" "+ currentQuote.isFave());
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement