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.fragments.PhotoViewFragment; 7 8 public interface PhotoViewCallbacks { 9 /** 10 * Listener to be invoked for screen events. 11 */ 12 public static interface OnScreenListener { 13 14 /** 15 * The full screen state has changed. 16 */ onFullScreenChanged(boolean fullScreen)17 public void onFullScreenChanged(boolean fullScreen); 18 19 /** 20 * A new view has been activated and the previous view de-activated. 21 */ onViewActivated()22 public void onViewActivated(); 23 24 /** 25 * Called when a right-to-left touch move intercept is about to occur. 26 * 27 * @param origX the raw x coordinate of the initial touch 28 * @param origY the raw y coordinate of the initial touch 29 * @return {@code true} if the touch should be intercepted. 30 */ onInterceptMoveLeft(float origX, float origY)31 public boolean onInterceptMoveLeft(float origX, float origY); 32 33 /** 34 * Called when a left-to-right 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 */ onInterceptMoveRight(float origX, float origY)40 public boolean onInterceptMoveRight(float origX, float origY); 41 } 42 43 public static interface CursorChangedListener { 44 /** 45 * Called when the cursor that contains the photo list data 46 * is updated. Note that there is no guarantee that the cursor 47 * will be at the proper position. 48 * @param cursor the cursor containing the photo list data 49 */ onCursorChanged(Cursor cursor)50 public void onCursorChanged(Cursor cursor); 51 } 52 addScreenListener(OnScreenListener listener)53 public void addScreenListener(OnScreenListener listener); 54 removeScreenListener(OnScreenListener listener)55 public void removeScreenListener(OnScreenListener listener); 56 addCursorListener(CursorChangedListener listener)57 public void addCursorListener(CursorChangedListener listener); 58 removeCursorListener(CursorChangedListener listener)59 public void removeCursorListener(CursorChangedListener listener); 60 setViewActivated()61 public void setViewActivated(); 62 toggleFullScreen()63 public void toggleFullScreen(); 64 isFragmentActive(Fragment fragment)65 public boolean isFragmentActive(Fragment fragment); 66 onFragmentVisible(PhotoViewFragment fragment)67 public void onFragmentVisible(PhotoViewFragment fragment); 68 isFragmentFullScreen(Fragment fragment)69 public boolean isFragmentFullScreen(Fragment fragment); 70 } 71