示例#1
0
  public void write(TProtocol oprot) throws TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(START_INDEX_FIELD_DESC);
    oprot.writeI32(this.startIndex);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(TOTAL_NOTES_FIELD_DESC);
    oprot.writeI32(this.totalNotes);
    oprot.writeFieldEnd();
    if (this.notes != null) {
      oprot.writeFieldBegin(NOTES_FIELD_DESC);
      {
        oprot.writeListBegin(new TList(TType.STRUCT, this.notes.size()));
        for (com.evernote.edam.type.Note _iter57 : this.notes) {
          _iter57.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.stoppedWords != null) {
      if (isSetStoppedWords()) {
        oprot.writeFieldBegin(STOPPED_WORDS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.STRING, this.stoppedWords.size()));
          for (String _iter58 : this.stoppedWords) {
            oprot.writeString(_iter58);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
    }
    if (this.searchedWords != null) {
      if (isSetSearchedWords()) {
        oprot.writeFieldBegin(SEARCHED_WORDS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.STRING, this.searchedWords.size()));
          for (String _iter59 : this.searchedWords) {
            oprot.writeString(_iter59);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
    }
    if (isSetUpdateCount()) {
      oprot.writeFieldBegin(UPDATE_COUNT_FIELD_DESC);
      oprot.writeI32(this.updateCount);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }
示例#2
0
 public List<Note> getEntryData() {
   List<Note> res = new ArrayList<>();
   for (SyndEntryImpl list1 : (List<SyndEntryImpl>) feedContent.getEntries()) {
     if (list1 == null || list1.equals(last)) break;
     Note addition = new Note();
     //            print(addition + " " + last);
     addition.setTitle(list1.getTitle());
     addition.setContent(list1.getLink());
     res.add(addition);
   }
   last = (SyndEntryImpl) feedContent.getEntries().get(0);
   return res;
 }
  public Note makeNote(
      EvernoteNoteStoreClient noteStore,
      String noteTitle,
      String noteBody,
      Bitmap... imageResources) {

    // Create a Note instance with title and body
    // Send Note object to user's account
    Note note = new Note();
    note.setTitle(noteTitle);

    // Build body of note
    StringBuilder body = new StringBuilder(EvernoteUtil.NOTE_PREFIX).append(noteBody);

    if (imageResources != null && imageResources.length > 0) {
      // Create Resource objects from image resources and add them to note body
      body.append("<br /><br />");
      List<Resource> resources = new ArrayList<>(imageResources.length);
      note.setResources(resources);
      for (Bitmap image : imageResources) {
        Resource r = makeResource(image);
        if (r == null) continue;
        resources.add(r);
        body.append("Attachment with hash ")
            .append(Arrays.toString(r.getData().getBodyHash()))
            .append(": <br /><en-media type=\"")
            .append(r.getMime())
            .append("\" hash=\"")
            .append(Arrays.toString(r.getData().getBodyHash()))
            .append("\" /><br />");
      }
      body.append(EvernoteUtil.NOTE_SUFFIX);

      note.setContent(body.toString());

      // Attempt to create note in Evernote account
      try {
        note = noteStore.createNote(note);
      } catch (Exception e) {
        // Something was wrong with the note data
        // See EDAMErrorCode enumeration for error code explanation
        // http://dev.evernote.com/documentation/reference/Errors.html#Enum_EDAMErrorCode
        Toast.makeText(this, R.string.save_note_error, Toast.LENGTH_LONG).show();
        note = null;
      }
    }

    // Return created note object
    return note;
  }
示例#4
0
 public void read(TProtocol iprot) throws TException {
   TField field;
   iprot.readStructBegin();
   while (true) {
     field = iprot.readFieldBegin();
     if (field.type == TType.STOP) {
       break;
     }
     switch (field.id) {
       case 1: // START_INDEX
         if (field.type == TType.I32) {
           this.startIndex = iprot.readI32();
           setStartIndexIsSet(true);
         } else {
           TProtocolUtil.skip(iprot, field.type);
         }
         break;
       case 2: // TOTAL_NOTES
         if (field.type == TType.I32) {
           this.totalNotes = iprot.readI32();
           setTotalNotesIsSet(true);
         } else {
           TProtocolUtil.skip(iprot, field.type);
         }
         break;
       case 3: // NOTES
         if (field.type == TType.LIST) {
           {
             TList _list48 = iprot.readListBegin();
             this.notes = new ArrayList<com.evernote.edam.type.Note>(_list48.size);
             for (int _i49 = 0; _i49 < _list48.size; ++_i49) {
               com.evernote.edam.type.Note _elem50;
               _elem50 = new com.evernote.edam.type.Note();
               _elem50.read(iprot);
               this.notes.add(_elem50);
             }
             iprot.readListEnd();
           }
         } else {
           TProtocolUtil.skip(iprot, field.type);
         }
         break;
       case 4: // STOPPED_WORDS
         if (field.type == TType.LIST) {
           {
             TList _list51 = iprot.readListBegin();
             this.stoppedWords = new ArrayList<String>(_list51.size);
             for (int _i52 = 0; _i52 < _list51.size; ++_i52) {
               String _elem53;
               _elem53 = iprot.readString();
               this.stoppedWords.add(_elem53);
             }
             iprot.readListEnd();
           }
         } else {
           TProtocolUtil.skip(iprot, field.type);
         }
         break;
       case 5: // SEARCHED_WORDS
         if (field.type == TType.LIST) {
           {
             TList _list54 = iprot.readListBegin();
             this.searchedWords = new ArrayList<String>(_list54.size);
             for (int _i55 = 0; _i55 < _list54.size; ++_i55) {
               String _elem56;
               _elem56 = iprot.readString();
               this.searchedWords.add(_elem56);
             }
             iprot.readListEnd();
           }
         } else {
           TProtocolUtil.skip(iprot, field.type);
         }
         break;
       case 6: // UPDATE_COUNT
         if (field.type == TType.I32) {
           this.updateCount = iprot.readI32();
           setUpdateCountIsSet(true);
         } else {
           TProtocolUtil.skip(iprot, field.type);
         }
         break;
       default:
         TProtocolUtil.skip(iprot, field.type);
     }
     iprot.readFieldEnd();
   }
   iprot.readStructEnd();
   validate();
 }