use of com.googlecode.flickrjandroid.photos.Photo in project GestureViews by alexvasilkov.
the class PhotoListAdapter method onClick.
@Override
public void onClick(@NonNull View view) {
Photo photo = (Photo) view.getTag(R.id.tag_item);
int pos = photos.indexOf(photo);
listener.onPhotoClick(pos);
}
use of com.googlecode.flickrjandroid.photos.Photo in project GestureViews by alexvasilkov.
the class PhotoPagerAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
if (setupListener != null) {
setupListener.onSetupGestureView(holder.image);
}
// Temporary disabling touch controls
if (!holder.gesturesDisabled) {
holder.image.getController().getSettings().disableGestures();
holder.gesturesDisabled = true;
}
holder.progress.animate().setStartDelay(PROGRESS_DELAY).alpha(1f);
Photo photo = photos.get(position);
// Loading image
GlideHelper.loadFlickrFull(photo, holder.image, new GlideHelper.ImageLoadingListener() {
@Override
public void onLoaded() {
holder.progress.animate().cancel();
holder.progress.animate().alpha(0f);
// Re-enabling touch controls
if (holder.gesturesDisabled) {
holder.image.getController().getSettings().enableGestures();
holder.gesturesDisabled = false;
}
}
@Override
public void onFailed() {
holder.progress.animate().alpha(0f);
}
});
}
use of com.googlecode.flickrjandroid.photos.Photo in project GestureViews by alexvasilkov.
the class FlickrApi method loadImages.
@Background(singleThread = true)
@Subscribe(LOAD_IMAGES_EVENT)
private static synchronized EventResult loadImages(int count) throws Exception {
SearchParameters params = new SearchParameters();
params.setText(SEARCH_QUERY);
params.setSafeSearch(Flickr.SAFETYLEVEL_SAFE);
params.setSort(SearchParameters.RELEVANCE);
params.setLicense(LICENCE_ID);
params.setExtras(photoParams);
boolean hasNext = hasNext();
while (photos.size() < count && hasNext) {
PhotoList loaded = new Flickr(API_KEY).getPhotosInterface().search(params, PER_PAGE, pages.size() + 1);
pages.add(loaded);
photos.addAll(loaded);
hasNext = hasNext();
}
int resultSize;
if (photos.size() >= count) {
resultSize = count;
} else {
resultSize = photos.size();
}
List<Photo> result = new ArrayList<>(photos.subList(0, resultSize));
if (!hasNext) {
hasNext = photos.size() > count;
}
return EventResult.create().result(result, hasNext).build();
}
Aggregations