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