use of com.trovebox.android.common.model.Photo in project mobile-android by photo.
the class PhotosEndlessAdapter method photoIndex.
public int photoIndex(Photo photo) {
int index = -1;
List<Photo> photos = getItems();
for (int i = 0, size = photos.size(); i < size; i++) {
Photo photo2 = photos.get(i);
if (photo2.getId().equals(photo.getId())) {
index = i;
break;
}
}
return index;
}
use of com.trovebox.android.common.model.Photo in project mobile-android by photo.
the class PhotoDetailsFragment method invalidateSelection.
void invalidateSelection(View view) {
View border = view.findViewById(R.id.background_container);
Photo photo = (Photo) border.getTag();
border.setBackgroundResource(isSelected(photo) ? R.color.detail_thumb_selected_border : R.color.detail_thumb_unselected_border);
}
use of com.trovebox.android.common.model.Photo in project mobile-android by photo.
the class PhotoDetailsFragment method isSelected.
boolean isSelected(Photo photo) {
if (mAdapter != null) {
Photo selectedPhoto = mAdapter.currentPhoto;
boolean result = selectedPhoto != null && selectedPhoto.getId().equals(photo.getId());
CommonUtils.debug(TAG, "Is selected: " + result);
return result;
}
return false;
}
use of com.trovebox.android.common.model.Photo in project mobile-android by photo.
the class PhotoUtils method getAndRegisterOnPhotoDeletedActionBroadcastReceiver.
/**
* Get and register the broadcast receiver for the photo removed event
*
* @param TAG
* @param handler
* @param activity
* @return
*/
public static BroadcastReceiver getAndRegisterOnPhotoDeletedActionBroadcastReceiver(final String TAG, final PhotoDeletedHandler handler, final Activity activity) {
BroadcastReceiver br = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
try {
CommonUtils.debug(TAG, "Received photo deleted broadcast message");
Photo photo = intent.getParcelableExtra(PHOTO_DELETED);
handler.photoDeleted(photo);
} catch (Exception ex) {
GuiUtils.error(TAG, ex);
}
}
};
activity.registerReceiver(br, new IntentFilter(PHOTO_DELETED_ACTION));
return br;
}
use of com.trovebox.android.common.model.Photo in project mobile-android by photo.
the class PhotoUtils method validateUrlForSizeExistAndReturn.
/**
* Validate whether the photo has url for the required size. If not then
* retrieve the photo with this size
*
* @param photo
* @param photoSize
* @return
* @throws ClientProtocolException
* @throws IOException
* @throws JSONException
*/
public static Photo validateUrlForSizeExistAndReturn(Photo photo, ReturnSizes photoSize) throws ClientProtocolException, IOException, JSONException {
String size = photoSize.toString();
if (photo.getUrl(size) != null) {
CommonUtils.debug(TAG, "Url for the size " + size + " exists");
} else {
CommonUtils.debug(TAG, "Url for the size " + size + " doesn't exist. Running size retrieval method.");
Photo photo2 = getThePhotoWithReturnSize(photo, photoSize);
photo.putUrl(size, photo2.getUrl(size));
}
return photo;
}
Aggregations