• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2012 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.gallery3d.app;
17 
18 import android.graphics.Rect;
19 import android.os.Parcel;
20 import android.os.Parcelable;
21 
22 import com.android.gallery3d.ui.ScreenNail;
23 
24 // This is the bridge to connect a PhotoPage to the external environment.
25 public abstract class AppBridge implements Parcelable {
describeContents()26     public int describeContents() {
27         return 0;
28     }
29 
writeToParcel(Parcel dest, int flags)30     public void writeToParcel(Parcel dest, int flags) {
31     }
32 
33     //////////////////////////////////////////////////////////////////////////
34     //  These are requests sent from PhotoPage to the app
35     //////////////////////////////////////////////////////////////////////////
36 
isPanorama()37     public abstract boolean isPanorama();
attachScreenNail()38     public abstract ScreenNail attachScreenNail();
detachScreenNail()39     public abstract void detachScreenNail();
40 
41     // Return true if the tap is consumed.
onSingleTapUp(int x, int y)42     public abstract boolean onSingleTapUp(int x, int y);
43 
44     // This is used to notify that the screen nail will be drawn in full screen
45     // or not in next draw() call.
onFullScreenChanged(boolean full)46     public abstract void onFullScreenChanged(boolean full);
47 
48     //////////////////////////////////////////////////////////////////////////
49     //  These are requests send from app to PhotoPage
50     //////////////////////////////////////////////////////////////////////////
51 
52     public interface Server {
53         // Set the camera frame relative to GLRootView.
setCameraRelativeFrame(Rect frame)54         public void setCameraRelativeFrame(Rect frame);
55         // Switch to the previous or next picture using the capture animation.
56         // The offset is -1 to switch to the previous picture, 1 to switch to
57         // the next picture.
switchWithCaptureAnimation(int offset)58         public boolean switchWithCaptureAnimation(int offset);
59         // Enable or disable the swiping gestures (the default is enabled).
setSwipingEnabled(boolean enabled)60         public void setSwipingEnabled(boolean enabled);
61         // Notify that the ScreenNail is changed.
notifyScreenNailChanged()62         public void notifyScreenNailChanged();
63     }
64 
65     // If server is null, the services are not available.
setServer(Server server)66     public abstract void setServer(Server server);
67 }
68