1 /* 2 * Copyright (C) 2017 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 17 package com.android.layout.remote.api; 18 19 import com.android.ide.common.rendering.api.AdapterBinding; 20 import com.android.ide.common.rendering.api.LayoutlibCallback; 21 import com.android.ide.common.rendering.api.LayoutlibCallback.ViewAttribute; 22 import com.android.ide.common.rendering.api.ResourceReference; 23 import com.android.ide.common.rendering.api.ResourceValue; 24 import com.android.ide.common.rendering.api.SessionParams.Key; 25 26 import java.nio.file.Path; 27 import java.rmi.Remote; 28 import java.rmi.RemoteException; 29 30 /** 31 * Remote version of the {@link LayoutlibCallback} class 32 */ 33 public interface RemoteLayoutlibCallback extends Remote { loadView(String name, Class[] constructorSignature, Object[] constructorArgs)34 Object loadView(String name, Class[] constructorSignature, Object[] constructorArgs) 35 throws Exception; 36 resolveResourceId(int id)37 ResourceReference resolveResourceId(int id) throws RemoteException; 38 getOrGenerateResourceId(ResourceReference resource)39 int getOrGenerateResourceId(ResourceReference resource) throws RemoteException; 40 getParser(ResourceValue layoutResource)41 RemoteILayoutPullParser getParser(ResourceValue layoutResource) throws RemoteException; 42 getAdapterItemValue(ResourceReference adapterView, Object adapterCookie, ResourceReference itemRef, int fullPosition, int positionPerType, int fullParentPosition, int parentPositionPerType, ResourceReference viewRef, ViewAttribute viewAttribute, Object defaultValue)43 Object getAdapterItemValue(ResourceReference adapterView, Object adapterCookie, 44 ResourceReference itemRef, int fullPosition, int positionPerType, 45 int fullParentPosition, int parentPositionPerType, ResourceReference viewRef, 46 ViewAttribute viewAttribute, Object defaultValue) throws RemoteException; 47 getAdapterBinding(ResourceReference adapterViewRef, Object adapterCookie, Object viewObject)48 AdapterBinding getAdapterBinding(ResourceReference adapterViewRef, Object adapterCookie, 49 Object viewObject) throws RemoteException; 50 getActionBarCallback()51 RemoteActionBarCallback getActionBarCallback() throws RemoteException; 52 getFlag(Key<T> key)53 <T> T getFlag(Key<T> key) throws RemoteException; 54 findClassPath(String name)55 Path findClassPath(String name) throws RemoteException; 56 createXmlParserForPsiFile(String fileName)57 RemoteXmlPullParser createXmlParserForPsiFile(String fileName) throws RemoteException; 58 createXmlParserForFile(String fileName)59 RemoteXmlPullParser createXmlParserForFile(String fileName) throws RemoteException; 60 createXmlParser()61 RemoteXmlPullParser createXmlParser() throws RemoteException; 62 } 63