本文整理汇总了Java中com.evernote.edam.type.Note.getResources方法的典型用法代码示例。如果您正苦于以下问题:Java Note.getResources方法的具体用法?Java Note.getResources怎么用?Java Note.getResources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.evernote.edam.type.Note
的用法示例。
在下文中一共展示了Note.getResources方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: stereoForImages
import com.evernote.edam.type.Note; //导入方法依赖的package包/类
@Override
public String[] stereoForImages(Note note) {
if (note == null || note.getResources().size() == 0)
return new String[0];
String imageid = getImageID(note.getResources().get(0));
String instrument = imageid.substring(instrumentIndex, instrumentIndex + 1);
if (!stereoInstruments.contains(instrument))
return new String[0];
int leftImageIndex = -1;
int rightImageIndex = -1;
int index = 0;
for (Resource resource : note.getResources()) {
imageid = getImageID(resource);
String eye = imageid.substring(eyeIndex, eyeIndex + 1);
if (leftImageIndex == -1 && eye.equals("L"))
leftImageIndex = index;
if (rightImageIndex == -1 && eye.equals("R"))
rightImageIndex = index;
index += 1;
}
if (leftImageIndex >= 0 && rightImageIndex >= 0) {
return new String[]{
note.getResources().get(leftImageIndex).getAttributes().getSourceURL(),
note.getResources().get(rightImageIndex).getAttributes().getSourceURL()
};
}
return new String[0];
}
示例3: stereoForImages
import com.evernote.edam.type.Note; //导入方法依赖的package包/类
public String[] stereoForImages(Note note) {
if (note == null || note.getResources().size() == 0)
return new String[0];
String imageid = getImageID(note.getResources().get(0));
String instrument = imageid.substring(instrumentIndex, instrumentIndex + 1);
if (!stereoInstruments.contains(instrument) && !imageid.startsWith("Sol"))
return new String[0];
int leftImageIndex = -1;
int rightImageIndex = -1;
int index = 0;
for (Resource resource : note.getResources()) {
imageid = getImageID(resource);
String eye = imageid.substring(eyeIndex, eyeIndex + 1);
if (leftImageIndex == -1 && eye.equals("L") && !imageid.startsWith("Sol"))
leftImageIndex = index;
if (rightImageIndex == -1 && eye.equals("R"))
rightImageIndex = index;
index += 1;
}
if (leftImageIndex >= 0 && rightImageIndex >= 0) {
return new String[]{
note.getResources().get(leftImageIndex).getAttributes().getSourceURL(),
note.getResources().get(rightImageIndex).getAttributes().getSourceURL()};
}
return new String[0];
}
示例4: setupCaptionAndImageSelectionMenu
import com.evernote.edam.type.Note; //导入方法依赖的package包/类
private void setupCaptionAndImageSelectionMenu(final Note note) {
if (getActivity() == null) return;
// final boolean fullscreen = ((ImageViewActivity) getActivity()).isFullscreen();
// mCaptionView.setAlpha(fullscreen ? 0 : 1);
// mSelectButton.setAlpha(fullscreen ? 0 : 1);
String caption = MARS_IMAGES.getMission().getCaptionText(note);
mCaptionView.setText(caption);
if (note.getResources().size() <= 1)
mSelectButton.setVisibility(View.INVISIBLE);
else {
Resource resource = resourceNumber >= note.getResources().size() ? null : note.getResources().get(resourceNumber);
String buttonText = (resource == null) ? ANAGLYPH : MARS_IMAGES.getMission().getImageName(resource);
mSelectButton.setText(buttonText);
final List<String> menuItemNames = Lists.newArrayList();
for (Resource r : note.getResources()) {
String imageName = MARS_IMAGES.getMission().getImageName(r);
menuItemNames.add(imageName);
}
final String[] leftAndRight = MARS_IMAGES.getMission().stereoForImages(note);
if (leftAndRight.length > 0) {
menuItemNames.add(ANAGLYPH);
}
mSelectButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mPopupMenu = new PopupMenu(getActivity(), mSelectButton);
for (String menuItemName : menuItemNames) {
mPopupMenu.getMenu().add(Menu.NONE, menuItemNames.indexOf(menuItemName), Menu.NONE, menuItemName);
}
menuItemClickListener = new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
CharSequence title = menuItem.getTitle();
mSelectButton.setText(title);
resourceNumber = menuItem.getItemId();
if (resourceNumber < note.getResources().size()) {
String url = note.getResources().get(resourceNumber).getAttributes().getSourceURL();
mImageView.setImageDrawable(null);
loadImage(url, mImageView, mAttacher);
} else { //anaglyph
mImageView.setImageDrawable(null);
loadAnaglyph(leftAndRight, mImageView, mAttacher);
}
return false;
}
};
mPopupMenu.setOnMenuItemClickListener(menuItemClickListener);
mPopupMenu.show();
}
});
}
}