1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License") throws RemoteException;
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.RenderResources;
20 import com.android.ide.common.rendering.api.ResourceReference;
21 import com.android.ide.common.rendering.api.ResourceValue;
22 import com.android.ide.common.rendering.api.StyleResourceValue;
23 import com.android.tools.layoutlib.annotations.NotNull;
24 import com.android.tools.layoutlib.annotations.Nullable;
25 
26 import java.rmi.Remote;
27 import java.rmi.RemoteException;
28 import java.util.List;
29 
30 /**
31  * Remote version of the {@link RenderResources} class
32  */
33 public interface RemoteRenderResources extends Remote {
getDefaultTheme()34     RemoteResourceValue<StyleResourceValue> getDefaultTheme() throws RemoteException;
35 
applyStyle(RemoteResourceValue<StyleResourceValue> theme, boolean useAsPrimary)36     void applyStyle(RemoteResourceValue<StyleResourceValue> theme, boolean useAsPrimary) throws RemoteException;
37 
clearStyles()38     void clearStyles() throws RemoteException;
39 
getAllThemes()40     List<RemoteResourceValue<StyleResourceValue>> getAllThemes() throws RemoteException;
41 
42     @Nullable
getResolvedResource(@otNull ResourceReference reference)43     RemoteResourceValue<ResourceValue> getResolvedResource(@NotNull ResourceReference reference) throws RemoteException;
44 
findItemInTheme(ResourceReference attr)45     RemoteResourceValue<ResourceValue> findItemInTheme(ResourceReference attr) throws RemoteException;
46 
findItemInStyle(RemoteResourceValue<StyleResourceValue> style, ResourceReference attr)47     RemoteResourceValue<ResourceValue> findItemInStyle(RemoteResourceValue<StyleResourceValue> style,
48             ResourceReference attr)
49             throws RemoteException;
50 
resolveValue(RemoteResourceValue<ResourceValue> value)51     RemoteResourceValue<ResourceValue> resolveValue(RemoteResourceValue<ResourceValue> value) throws RemoteException;
52 
getParent(RemoteResourceValue<StyleResourceValue> style)53     RemoteResourceValue<StyleResourceValue> getParent(RemoteResourceValue<StyleResourceValue> style) throws RemoteException;
54 
55     @Nullable
getStyle(@otNull ResourceReference reference)56     RemoteResourceValue<StyleResourceValue> getStyle(@NotNull ResourceReference reference) throws RemoteException;
57 
dereference(RemoteResourceValue<ResourceValue> resourceValue)58     RemoteResourceValue<ResourceValue> dereference(RemoteResourceValue<ResourceValue> resourceValue) throws RemoteException;
59 
getUnresolvedResource(ResourceReference reference)60     RemoteResourceValue<ResourceValue> getUnresolvedResource(ResourceReference reference) throws RemoteException;
61 }
62