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 { 26 @Override 27 public int describeContents() { 28 return 0; 29 } 30 31 @Override 32 public void writeToParcel(Parcel dest, int flags) { 33 } 34 35 ////////////////////////////////////////////////////////////////////////// 36 // These are requests sent from PhotoPage to the app 37 ////////////////////////////////////////////////////////////////////////// 38 39 public abstract boolean isPanorama(); 40 public abstract boolean isStaticCamera(); 41 public abstract ScreenNail attachScreenNail(); 42 public abstract void detachScreenNail(); 43 44 // Return true if the tap is consumed. 45 public abstract boolean onSingleTapUp(int x, int y); 46 47 // This is used to notify that the screen nail will be drawn in full screen 48 // or not in next draw() call. 49 public abstract void onFullScreenChanged(boolean full); 50 51 ////////////////////////////////////////////////////////////////////////// 52 // These are requests send from app to PhotoPage 53 ////////////////////////////////////////////////////////////////////////// 54 55 public interface Server { 56 // Set the camera frame relative to GLRootView. 57 public void setCameraRelativeFrame(Rect frame); 58 // Switch to the previous or next picture using the capture animation. 59 // The offset is -1 to switch to the previous picture, 1 to switch to 60 // the next picture. 61 public boolean switchWithCaptureAnimation(int offset); 62 // Enable or disable the swiping gestures (the default is enabled). 63 public void setSwipingEnabled(boolean enabled); 64 // Notify that the ScreenNail is changed. 65 public void notifyScreenNailChanged(); 66 // Add a new media item to the secure album. 67 public void addSecureAlbumItem(boolean isVideo, int id); 68 } 69 70 // If server is null, the services are not available. 71 public abstract void setServer(Server server); 72 } 73