Home | History | Annotate | Download | only in photo
      1 package com.android.ex.photo;
      2 
      3 import android.database.Cursor;
      4 import android.os.Bundle;
      5 import android.support.v4.app.Fragment;
      6 import android.support.v4.content.Loader;
      7 
      8 import com.android.ex.photo.adapters.PhotoPagerAdapter;
      9 import com.android.ex.photo.fragments.PhotoViewFragment;
     10 import com.android.ex.photo.loaders.PhotoBitmapLoaderInterface.BitmapResult;
     11 
     12 public interface PhotoViewCallbacks {
     13 
     14     public static final int BITMAP_LOADER_AVATAR = 1;
     15     public static final int BITMAP_LOADER_THUMBNAIL = 2;
     16     public static final int BITMAP_LOADER_PHOTO = 3;
     17 
     18     /**
     19      * Listener to be invoked for screen events.
     20      */
     21     public static interface OnScreenListener {
     22 
     23         /**
     24          * The full screen state has changed.
     25          */
     26         public void onFullScreenChanged(boolean fullScreen);
     27 
     28         /**
     29          * A new view has been activated and the previous view de-activated.
     30          */
     31         public void onViewActivated();
     32 
     33         /**
     34          * Called when a right-to-left touch move intercept is about to occur.
     35          *
     36          * @param origX the raw x coordinate of the initial touch
     37          * @param origY the raw y coordinate of the initial touch
     38          * @return {@code true} if the touch should be intercepted.
     39          */
     40         public boolean onInterceptMoveLeft(float origX, float origY);
     41 
     42         /**
     43          * Called when a left-to-right touch move intercept is about to occur.
     44          *
     45          * @param origX the raw x coordinate of the initial touch
     46          * @param origY the raw y coordinate of the initial touch
     47          * @return {@code true} if the touch should be intercepted.
     48          */
     49         public boolean onInterceptMoveRight(float origX, float origY);
     50     }
     51 
     52     public static interface CursorChangedListener {
     53         /**
     54          * Called when the cursor that contains the photo list data
     55          * is updated. Note that there is no guarantee that the cursor
     56          * will be at the proper position.
     57          * @param cursor the cursor containing the photo list data
     58          */
     59         public void onCursorChanged(Cursor cursor);
     60     }
     61 
     62     public void addScreenListener(int position, OnScreenListener listener);
     63 
     64     public void removeScreenListener(int position);
     65 
     66     public void addCursorListener(CursorChangedListener listener);
     67 
     68     public void removeCursorListener(CursorChangedListener listener);
     69 
     70     public void setViewActivated(int position);
     71 
     72     public void onNewPhotoLoaded(int position);
     73 
     74     public void onFragmentPhotoLoadComplete(PhotoViewFragment fragment,
     75             boolean success);
     76 
     77     public void toggleFullScreen();
     78 
     79     public boolean isFragmentActive(Fragment fragment);
     80 
     81     public void onFragmentVisible(PhotoViewFragment fragment);
     82 
     83     public boolean isFragmentFullScreen(Fragment fragment);
     84 
     85     public void onCursorChanged(PhotoViewFragment fragment, Cursor cursor);
     86 
     87     public Loader<BitmapResult> onCreateBitmapLoader(int id, Bundle args, String uri);
     88 
     89     /**
     90      * Returns the adapter associated with this activity.
     91      */
     92     public PhotoPagerAdapter getAdapter();
     93 }
     94