本文整理汇总了Java中com.evernote.edam.type.Note类的典型用法代码示例。如果您正苦于以下问题:Java Note类的具体用法?Java Note怎么用?Java Note使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Note类属于com.evernote.edam.type包,在下文中一共展示了Note类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNote
import com.evernote.edam.type.Note; //导入依赖的package包/类
/**
* Creates a new note
*
* @param title The note's title
* @param content The note's content as EHTML
* @param date If not null used for created and updated date
* @param source Source attribute to be added to the note
* @throws Exception
*/
public Note createNote(String title, String content, Long date, String source) throws Exception {
LOG.debug("Creating new note: {}", title);
Note note = new Note();
note.setTitle(title);
note.setContent(content);
if ( date != null) {
note.setCreated(date);
note.setUpdated(date);
}
if (source != null && source.length()>0) {
NoteAttributes attributes = new NoteAttributes();
attributes.setSource(source);
note.setAttributes(attributes);
}
LOG.debug(content);
return noteStore.createNote(note);
}
示例2: parseFromNote
import com.evernote.edam.type.Note; //导入依赖的package包/类
public static GNote parseFromNote(Note note) {
GNote gNote = new GNote();
String content = Html.fromHtml(note.getContent()).toString();
// int length = content.length();
// gNote.content = content.substring(0, length - 2);//去除掉最后的两个换行符-_-||
gNote.content = content.replace("\n\n", "\n");
gNote.guid = note.getGuid();
gNote.bookGuid = note.getNotebookGuid();
gNote.createdTime = note.getCreated();
gNote.editTime = note.getUpdated();
parseTime(note, gNote);
return gNote;
}
示例3: parseTime
import com.evernote.edam.type.Note; //导入依赖的package包/类
private static void parseTime(Note note, GNote gNote) {
boolean setTime = false;
String title = note.getTitle();
String[] tmp = title.split(" ");
if (tmp.length == 2) {
String[] allInfo = tmp[1].split("\\.");
if (allInfo.length == 3) {
gNote.setTime(Util.parseTimeStamp(allInfo));
setTime = true;
}
}
if (!setTime) {
Calendar today = Calendar.getInstance();
gNote.setCalToTime(today);
}
}
示例4: create
import com.evernote.edam.type.Note; //导入依赖的package包/类
private void create(final ENNote args) throws EDAMUserException, EDAMSystemException, EDAMNotFoundException, TException, ParserConfigurationException, SAXException, IOException {
Note note = new Note();
note.setTitle(StringUtils.abbreviate(args.getName(), EDAMLimits.EDAM_NOTE_TITLE_LEN_MAX));
if (StringUtils.isNotBlank(args.getNotebook().getGuid())) {
note.setNotebookGuid(args.getNotebook().getGuid());
}
ENML enml = new ENML();
enml.setTabWidth(args.getTabWidth());
enml.addComment(args.getComments());
enml.addContent(args.getContent());
note.setContent(enml.get());
for (String tagName : args.getTags()) {
tagName = tagName.trim();
if (StringUtils.isNotBlank(tagName)) {
note.addToTagNames(tagName);
}
}
getNoteStoreClient(args).createNote(note);
}
示例5: listNoteBooks
import com.evernote.edam.type.Note; //导入依赖的package包/类
public List<Notebook> listNoteBooks() throws Exception {
List<Notebook> notebooks = noteStore.listNotebooks();
for (Notebook notebook : notebooks) {
NoteFilter filter = new NoteFilter();
filter.setNotebookGuid(notebook.getGuid());
filter.setOrder(NoteSortOrder.CREATED.getValue());
filter.setAscending(true);
NoteList noteList = noteStore.findNotes(filter, 0, 100);
List<Note> notes = noteList.getNotes();
for (Note note : notes) {
System.out.println(" * " + note.getTitle());
}
}
return notebooks;
}
示例6: listNotes
import com.evernote.edam.type.Note; //导入依赖的package包/类
/**
* Retrieve and display a list of the user's notes.
*/
private void listNotes() throws Exception {
// List the notes in the user's account
System.out.println("Listing notes:");
// First, get a list of all notebooks
List<Notebook> notebooks = noteStore.listNotebooks();
for (Notebook notebook : notebooks) {
System.out.println("Notebook: " + notebook.getName());
// Next, search for the first 100 notes in this notebook, ordering
// by creation date
NoteFilter filter = new NoteFilter();
filter.setNotebookGuid(notebook.getGuid());
filter.setOrder(NoteSortOrder.CREATED.getValue());
filter.setAscending(true);
NoteList noteList = noteStore.findNotes(filter, 0, 100);
List<Note> notes = noteList.getNotes();
for (Note note : notes) {
System.out.println(" * " + note.getTitle());
}
}
System.out.println();
}
示例7: getNoteLabel
import com.evernote.edam.type.Note; //导入依赖的package包/类
public SSLabel getNoteLabel(
final Note note) throws SSErr {
try{
final SSLabel tmpLabel = SSLabel.get(note.getTitle());
if(tmpLabel == null){
return getDefaultLabel();
}else{
return tmpLabel;
}
}catch(Exception error){
SSLogU.warn(error);
return getDefaultLabel();
}
}
示例8: getResourceLabel
import com.evernote.edam.type.Note; //导入依赖的package包/类
private SSLabel getResourceLabel(
final Resource resource,
final Note note) throws SSErr{
try{
if(
SSObjU.isNull (resource, resource.getAttributes()) ||
SSStrU.isEmpty(resource.getAttributes().getFileName())){
return getNoteLabel(note);
}
return SSLabel.get(resource.getAttributes().getFileName());
}catch(Exception error){
SSLogU.warn(error);
return getDefaultLabel();
}
}
示例9: evernoteNoteGet
import com.evernote.edam.type.Note; //导入依赖的package包/类
@Override
public Note evernoteNoteGet(final SSEvernoteNoteGetPar par) throws SSErr{
try{
return par.noteStore.getNote(par.noteGUID, par.includeContent, false, false, false);
}catch(EDAMSystemException edamError){
if(gotToSleep(edamError, SSStrU.empty)){
return evernoteNoteGet (par);
}else{
SSServErrReg.regErrThrow(edamError);
return null;
}
}catch(Exception error){
SSServErrReg.regErrThrow(error);
return null;
}
}
示例10: reorderResources
import com.evernote.edam.type.Note; //导入依赖的package包/类
private Note reorderResources(Note note) {
List<String> resourceFilenames = Lists.newArrayList();
Map<String, Resource> resourcesByFile = Maps.newHashMap();
for (Resource resource : note.getResources()) {
Rover mission = MARS_IMAGES.getMission();
String filename = mission.getSortableImageFilename(resource.getAttributes().getSourceURL());
resourceFilenames.add(filename);
resourcesByFile.put(filename, resource);
}
Collections.sort(resourceFilenames);
List<Resource> sortedResources = Lists.newArrayList();
for (String resourceFilename : resourceFilenames) {
sortedResources.add(resourcesByFile.get(resourceFilename));
}
note.setResources(sortedResources);
return note;
}
示例11: saveImageToGallery
import com.evernote.edam.type.Note; //导入依赖的package包/类
public void saveImageToGallery() {
Note thisNote = EVERNOTE.getNote(mPager.getCurrentItem());
new AsyncTask<Object, Void, Void>() {
@Override
protected Void doInBackground(Object... params) {
if (!(params[0] instanceof Note) || !(params[1] instanceof Integer))
return null;
saveImageToExternalStorage((Note) params[0], (Integer) params[1]);
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
CharSequence text = getString(R.string.gallery_saved);
Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
}
}.execute(thisNote, mPager.getCurrentItem());
}
示例12: binImagesByPointing
import com.evernote.edam.type.Note; //导入依赖的package包/类
private void binImagesByPointing(List<Note> imagesForRMC, Map<String, JSONArray> modelsForNotes) {
Rover rover = MARS_IMAGES.getMission();
for (Note prospectiveImage : imagesForRMC) {
//filter out any images that aren't on the mast i.e. mosaic-able.
if (!Rover.includedInMosaic(prospectiveImage))
continue;
double[] v2 = CameraModel.pointingVector(modelsForNotes.get(prospectiveImage.getTitle()));
double angleThreshold = rover.fieldOfView(prospectiveImage)/20; //less overlap than ~5 degrees for Mastcam is problem for memory: see 42-852 looking south for example
boolean tooCloseToAnotherImage = false;
for (String title : notesInScene.keySet()) {
Note image = notesInScene.get(title);
double[] v1 = CameraModel.pointingVector(modelsForNotes.get(image.getTitle()));
if (CameraModel.angularDistance(v1, v2) < angleThreshold &&
M.epsilonEquals(rover.fieldOfView(image), rover.fieldOfView(prospectiveImage))) {
tooCloseToAnotherImage = true;
break;
}
}
if (!tooCloseToAnotherImage)
notesInScene.put(prospectiveImage.getTitle(), prospectiveImage);
}
}
示例13: onCreateView
import com.evernote.edam.type.Note; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View v = inflater.inflate(R.layout.image_view_fragment, container, false);
mImageView = (ImageView) v.findViewById(R.id.imageView);
mImageView.setTag(imageViewTag);
setupPhotoViewAttacher();
mCaptionView = (TextView) v.findViewById(R.id.captionView);
mSelectButton = (Button) v.findViewById(R.id.selectImageButton);
final Note note = EVERNOTE.getNote(imageNumber);
if (note != null) {
setupCaptionAndImageSelectionMenu(note);
}
return v;
}
示例14: onActivityCreated
import com.evernote.edam.type.Note; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Note note = EVERNOTE.getNote(imageNumber);
if (note == null) return;
if (resourceNumber < note.getResources().size())
loadImage(mImageUrl, mImageView, mAttacher);
else {
final String[] leftAndRight = MARS_IMAGES.getMission().stereoForImages(note);
loadAnaglyph(leftAndRight, mImageView, mAttacher);
}
// Pass clicks on the ImageView to the parent activity to handle
if (View.OnClickListener.class.isInstance(getActivity()) && Utils.hasHoneycomb()) {
mImageView.setOnClickListener((View.OnClickListener) getActivity());
}
IntentFilter filter = new IntentFilter(MarsImagesApp.MISSION_CHANGED);
filter.addAction(EvernoteMars.END_NOTE_LOADING);
filter.addAction(MarsImagesApp.NOTES_CLEARED);
LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mMessageReceiver,
filter);
}
示例15: onCreateNewNote
import com.evernote.edam.type.Note; //导入依赖的package包/类
@TaskResult
public void onCreateNewNote(Note note) {
if (note != null) {
refresh();
} else {
ViewUtil.showSnackbar(mSwipeRefreshLayout, "Create note failed");
}
}