PhotoViewCallbacks.java revision 41db3eb9741a222432b367409c67d2263856a0a7
1package com.android.ex.photo;
2
3import android.database.Cursor;
4import android.support.v4.app.Fragment;
5
6import com.android.ex.photo.adapters.PhotoPagerAdapter;
7import com.android.ex.photo.fragments.PhotoViewFragment;
8
9public 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         */
18        public void onFullScreenChanged(boolean fullScreen);
19
20        /**
21         * A new view has been activated and the previous view de-activated.
22         */
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         */
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         */
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         */
51        public void onCursorChanged(Cursor cursor);
52    }
53
54    public void addScreenListener(int position, OnScreenListener listener);
55
56    public void removeScreenListener(int position);
57
58    public void addCursorListener(CursorChangedListener listener);
59
60    public void removeCursorListener(CursorChangedListener listener);
61
62    public void setViewActivated(int position);
63
64    public void onNewPhotoLoaded(int position);
65
66    public void toggleFullScreen();
67
68    public boolean isFragmentActive(Fragment fragment);
69
70    public void onFragmentVisible(PhotoViewFragment fragment);
71
72    public boolean isFragmentFullScreen(Fragment fragment);
73
74    public void onCursorChanged(PhotoViewFragment fragment, Cursor cursor);
75
76    /**
77     * Returns the adapter associated with this activity.
78     */
79    public PhotoPagerAdapter getAdapter();
80}
81