Search in sources :

Example 6 with Photo

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;
}
Also used : Photo(com.trovebox.android.common.model.Photo)

Example 7 with Photo

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);
}
Also used : Photo(com.trovebox.android.common.model.Photo) AdapterView(org.holoeverywhere.widget.AdapterView) ImageView(android.widget.ImageView) View(android.view.View) HorizontalListView(com.trovebox.android.common.ui.widget.HorizontalListView) PhotoView(uk.co.senab.photoview.PhotoView) TextView(android.widget.TextView)

Example 8 with Photo

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;
}
Also used : Photo(com.trovebox.android.common.model.Photo)

Example 9 with Photo

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;
}
Also used : Context(android.content.Context) IntentFilter(android.content.IntentFilter) Intent(android.content.Intent) Photo(com.trovebox.android.common.model.Photo) BroadcastReceiver(android.content.BroadcastReceiver) ClientProtocolException(org.apache.http.client.ClientProtocolException) JSONException(org.json.JSONException) IOException(java.io.IOException)

Example 10 with Photo

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;
}
Also used : Photo(com.trovebox.android.common.model.Photo)

Aggregations

Photo (com.trovebox.android.common.model.Photo)17 Intent (android.content.Intent)5 IOException (java.io.IOException)5 JSONException (org.json.JSONException)5 ClientProtocolException (org.apache.http.client.ClientProtocolException)4 View (android.view.View)3 TextView (android.widget.TextView)3 UploadMetaData (com.trovebox.android.common.net.UploadMetaData)3 UploadResponse (com.trovebox.android.common.net.UploadResponse)3 RunnableWithParameter (com.trovebox.android.common.util.RunnableWithParameter)3 File (java.io.File)3 ArrayList (java.util.ArrayList)3 BroadcastReceiver (android.content.BroadcastReceiver)2 Context (android.content.Context)2 IntentFilter (android.content.IntentFilter)2 OnClickListener (android.view.View.OnClickListener)2 Button (android.widget.Button)2 PhotoResponse (com.trovebox.android.common.net.PhotoResponse)2 PhotosResponse (com.trovebox.android.common.net.PhotosResponse)2 Notification (android.app.Notification)1