1399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdonpackage com.android.ex.photo; 2399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon 3399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdonimport android.database.Cursor; 4ca8fdcd23fcc53e0429abf8d4ef80e8d6d8fe6faMartin Hibdonimport android.os.Bundle; 5399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdonimport android.support.v4.app.Fragment; 6ca8fdcd23fcc53e0429abf8d4ef80e8d6d8fe6faMartin Hibdonimport android.support.v4.content.Loader; 7399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon 841db3eb9741a222432b367409c67d2263856a0a7Vikram Aggarwalimport com.android.ex.photo.adapters.PhotoPagerAdapter; 9399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdonimport com.android.ex.photo.fragments.PhotoViewFragment; 10ca8fdcd23fcc53e0429abf8d4ef80e8d6d8fe6faMartin Hibdonimport com.android.ex.photo.loaders.PhotoBitmapLoaderInterface.BitmapResult; 11399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon 12399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdonpublic interface PhotoViewCallbacks { 13ca8fdcd23fcc53e0429abf8d4ef80e8d6d8fe6faMartin Hibdon 14ca8fdcd23fcc53e0429abf8d4ef80e8d6d8fe6faMartin Hibdon public static final int BITMAP_LOADER_AVATAR = 1; 15ca8fdcd23fcc53e0429abf8d4ef80e8d6d8fe6faMartin Hibdon public static final int BITMAP_LOADER_THUMBNAIL = 2; 16ca8fdcd23fcc53e0429abf8d4ef80e8d6d8fe6faMartin Hibdon public static final int BITMAP_LOADER_PHOTO = 3; 17ca8fdcd23fcc53e0429abf8d4ef80e8d6d8fe6faMartin Hibdon 18399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon /** 19399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon * Listener to be invoked for screen events. 20399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon */ 21399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon public static interface OnScreenListener { 22399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon 23399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon /** 24399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon * The full screen state has changed. 25399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon */ 26399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon public void onFullScreenChanged(boolean fullScreen); 27399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon 28399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon /** 29399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon * A new view has been activated and the previous view de-activated. 30399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon */ 31399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon public void onViewActivated(); 32399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon 33399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon /** 3419aeb66bd3bc22c2efbef8a4d20b0a65a7ecfd44Adam Copp * This view is a candidate for being the next view. 3519aeb66bd3bc22c2efbef8a4d20b0a65a7ecfd44Adam Copp * 3619aeb66bd3bc22c2efbef8a4d20b0a65a7ecfd44Adam Copp * This will be called when the view is focused completely on the view immediately before 3719aeb66bd3bc22c2efbef8a4d20b0a65a7ecfd44Adam Copp * or after this one, so that this view can reset itself if nessecary. 3819aeb66bd3bc22c2efbef8a4d20b0a65a7ecfd44Adam Copp */ 3919aeb66bd3bc22c2efbef8a4d20b0a65a7ecfd44Adam Copp public void onViewUpNext(); 4019aeb66bd3bc22c2efbef8a4d20b0a65a7ecfd44Adam Copp 4119aeb66bd3bc22c2efbef8a4d20b0a65a7ecfd44Adam Copp /** 42399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon * Called when a right-to-left touch move intercept is about to occur. 43399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon * 44399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon * @param origX the raw x coordinate of the initial touch 45399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon * @param origY the raw y coordinate of the initial touch 46399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon * @return {@code true} if the touch should be intercepted. 47399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon */ 48399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon public boolean onInterceptMoveLeft(float origX, float origY); 49399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon 50399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon /** 51399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon * Called when a left-to-right touch move intercept is about to occur. 52399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon * 53399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon * @param origX the raw x coordinate of the initial touch 54399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon * @param origY the raw y coordinate of the initial touch 55399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon * @return {@code true} if the touch should be intercepted. 56399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon */ 57399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon public boolean onInterceptMoveRight(float origX, float origY); 58399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon } 59399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon 60399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon public static interface CursorChangedListener { 61399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon /** 62399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon * Called when the cursor that contains the photo list data 63399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon * is updated. Note that there is no guarantee that the cursor 64399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon * will be at the proper position. 65399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon * @param cursor the cursor containing the photo list data 66399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon */ 67399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon public void onCursorChanged(Cursor cursor); 68399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon } 69399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon 7079bc0d5ba2f06b25052fe95fac1593ebde234d9aMark Wei public void addScreenListener(int position, OnScreenListener listener); 71399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon 7279bc0d5ba2f06b25052fe95fac1593ebde234d9aMark Wei public void removeScreenListener(int position); 73399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon 74399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon public void addCursorListener(CursorChangedListener listener); 75399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon 76399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon public void removeCursorListener(CursorChangedListener listener); 77399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon 7879bc0d5ba2f06b25052fe95fac1593ebde234d9aMark Wei public void setViewActivated(int position); 79399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon 8079bc0d5ba2f06b25052fe95fac1593ebde234d9aMark Wei public void onNewPhotoLoaded(int position); 81399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon 82ca8fdcd23fcc53e0429abf8d4ef80e8d6d8fe6faMartin Hibdon public void onFragmentPhotoLoadComplete(PhotoViewFragment fragment, 83ca8fdcd23fcc53e0429abf8d4ef80e8d6d8fe6faMartin Hibdon boolean success); 84ca8fdcd23fcc53e0429abf8d4ef80e8d6d8fe6faMartin Hibdon 85399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon public void toggleFullScreen(); 86399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon 87399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon public boolean isFragmentActive(Fragment fragment); 88399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon 89ca8fdcd23fcc53e0429abf8d4ef80e8d6d8fe6faMartin Hibdon public void onFragmentVisible(PhotoViewFragment fragment); 90399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon 91399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon public boolean isFragmentFullScreen(Fragment fragment); 920bf849421d303e05c600cdcd7dab73cc84809a36Mark Wei 930bf849421d303e05c600cdcd7dab73cc84809a36Mark Wei public void onCursorChanged(PhotoViewFragment fragment, Cursor cursor); 9441db3eb9741a222432b367409c67d2263856a0a7Vikram Aggarwal 95ca8fdcd23fcc53e0429abf8d4ef80e8d6d8fe6faMartin Hibdon public Loader<BitmapResult> onCreateBitmapLoader(int id, Bundle args, String uri); 96ca8fdcd23fcc53e0429abf8d4ef80e8d6d8fe6faMartin Hibdon 9741db3eb9741a222432b367409c67d2263856a0a7Vikram Aggarwal /** 9841db3eb9741a222432b367409c67d2263856a0a7Vikram Aggarwal * Returns the adapter associated with this activity. 9941db3eb9741a222432b367409c67d2263856a0a7Vikram Aggarwal */ 10041db3eb9741a222432b367409c67d2263856a0a7Vikram Aggarwal public PhotoPagerAdapter getAdapter(); 101399fe3d995ed4366a18c7ce6632b3014284df57aMartin Hibdon} 102