Exemplo n.º 1
0
 private void getMockListData() {
   notes = new ArrayList<Note>();
   for (int i = 0; i < 20; i++) {
     Note note = new Note();
     note.setDescription("Some test description text...");
     note.setDislikes(i);
     note.setLikes(20 - i);
     note.setFileName(
         "http://kinoman.triolan.com.ua/uploads/posts/2013-04/thumbs/1365855917_bezymyannyj.png");
     note.setFileNamePreview(
         "http://kinoman.triolan.com.ua/uploads/posts/2013-04/thumbs/1365855917_bezymyannyj.png");
     note.setId(i);
     note.setFileType(AppContext.PHOTO_FILE_TYPE);
     note.setIsCanSendComment(1);
     notes.add(note);
   }
 }
Exemplo n.º 2
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == NOTE_DETAILS_ACTIVITY_REQUEST_CODE) {
     if (resultCode == RESULT_OK) {
       int position = data.getIntExtra(AppContext.POSITION_KEY, 0);
       boolean isLike = data.getBooleanExtra(AppContext.IS_LIKE_KEY, false);
       if (notesAdapter != null && notes != null && position < notes.size()) {
         Note note = notes.get(position);
         if (isLike) {
           note.setLikes(note.getLikes() + 1);
         } else {
           note.setDislikes(note.getDislikes() + 1);
         }
         notesAdapter.notifyDataSetChanged();
       }
     }
   }
 }