Merge "Return complete properties map instead of per view" into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e70464e116
@@ -24,6 +24,7 @@ import com.android.ide.common.rendering.api.Result;
|
|||||||
import com.android.ide.common.rendering.api.ViewInfo;
|
import com.android.ide.common.rendering.api.ViewInfo;
|
||||||
import com.android.layoutlib.bridge.impl.RenderSessionImpl;
|
import com.android.layoutlib.bridge.impl.RenderSessionImpl;
|
||||||
import com.android.tools.layoutlib.java.System_Delegate;
|
import com.android.tools.layoutlib.java.System_Delegate;
|
||||||
|
import com.android.util.PropertiesMap;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -69,6 +70,11 @@ public class BridgeRenderSession extends RenderSession {
|
|||||||
return mSession.getSystemViewInfos();
|
return mSession.getSystemViewInfos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Object, PropertiesMap> getDefaultProperties() {
|
||||||
|
return mSession.getDefaultProperties();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result render(long timeout, boolean forceMeasure) {
|
public Result render(long timeout, boolean forceMeasure) {
|
||||||
try {
|
try {
|
||||||
@@ -196,10 +202,6 @@ public class BridgeRenderSession extends RenderSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public RenderSessionImpl getSessionImpl() {
|
|
||||||
return mSession;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*package*/ BridgeRenderSession(RenderSessionImpl scene, Result lastResult) {
|
/*package*/ BridgeRenderSession(RenderSessionImpl scene, Result lastResult) {
|
||||||
mSession = scene;
|
mSession = scene;
|
||||||
if (scene != null) {
|
if (scene != null) {
|
||||||
|
|||||||
@@ -27,12 +27,13 @@ import com.android.ide.common.rendering.api.ResourceValue;
|
|||||||
import com.android.ide.common.rendering.api.StyleResourceValue;
|
import com.android.ide.common.rendering.api.StyleResourceValue;
|
||||||
import com.android.layoutlib.bridge.Bridge;
|
import com.android.layoutlib.bridge.Bridge;
|
||||||
import com.android.layoutlib.bridge.BridgeConstants;
|
import com.android.layoutlib.bridge.BridgeConstants;
|
||||||
import com.android.layoutlib.bridge.android.PropertiesMap.Property;
|
|
||||||
import com.android.layoutlib.bridge.android.view.WindowManagerImpl;
|
import com.android.layoutlib.bridge.android.view.WindowManagerImpl;
|
||||||
import com.android.layoutlib.bridge.impl.ParserFactory;
|
import com.android.layoutlib.bridge.impl.ParserFactory;
|
||||||
import com.android.layoutlib.bridge.impl.Stack;
|
import com.android.layoutlib.bridge.impl.Stack;
|
||||||
import com.android.resources.ResourceType;
|
import com.android.resources.ResourceType;
|
||||||
import com.android.util.Pair;
|
import com.android.util.Pair;
|
||||||
|
import com.android.util.PropertiesMap;
|
||||||
|
import com.android.util.PropertiesMap.Property;
|
||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
@@ -153,7 +154,6 @@ public final class BridgeContext extends Context {
|
|||||||
private IBinder mBinder;
|
private IBinder mBinder;
|
||||||
private PackageManager mPackageManager;
|
private PackageManager mPackageManager;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some applications that target both pre API 17 and post API 17, set the newer attrs to
|
* Some applications that target both pre API 17 and post API 17, set the newer attrs to
|
||||||
* reference the older ones. For example, android:paddingStart will resolve to
|
* reference the older ones. For example, android:paddingStart will resolve to
|
||||||
@@ -276,8 +276,8 @@ public final class BridgeContext extends Context {
|
|||||||
return mRenderResources;
|
return mRenderResources;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PropertiesMap getDefaultPropMap(Object key) {
|
public Map<Object, PropertiesMap> getDefaultProperties() {
|
||||||
return mDefaultPropMaps.get(key);
|
return mDefaultPropMaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Configuration getConfiguration() {
|
public Configuration getConfiguration() {
|
||||||
@@ -1862,7 +1862,6 @@ public final class BridgeContext extends Context {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The cached value depends on
|
* The cached value depends on
|
||||||
* <ol>
|
* <ol>
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.android.layoutlib.bridge.android;
|
|
||||||
|
|
||||||
import com.android.layoutlib.bridge.android.PropertiesMap.Property;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An alias used for the value in {@link BridgeContext#mDefaultPropMaps}
|
|
||||||
*/
|
|
||||||
public class PropertiesMap extends HashMap<String, Property> {
|
|
||||||
|
|
||||||
public static class Property {
|
|
||||||
public final String resource;
|
|
||||||
public final String value;
|
|
||||||
|
|
||||||
public Property(String resource, String value) {
|
|
||||||
this.resource = resource;
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -286,7 +286,7 @@ public abstract class RenderAction<T extends RenderParams> extends FrameworkReso
|
|||||||
return mParams;
|
return mParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BridgeContext getContext() {
|
protected BridgeContext getContext() {
|
||||||
return mContext;
|
return mContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import com.android.layoutlib.bridge.impl.binding.FakeExpandableAdapter;
|
|||||||
import com.android.resources.ResourceType;
|
import com.android.resources.ResourceType;
|
||||||
import com.android.tools.layoutlib.java.System_Delegate;
|
import com.android.tools.layoutlib.java.System_Delegate;
|
||||||
import com.android.util.Pair;
|
import com.android.util.Pair;
|
||||||
|
import com.android.util.PropertiesMap;
|
||||||
|
|
||||||
import android.animation.AnimationThread;
|
import android.animation.AnimationThread;
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
@@ -1415,6 +1416,10 @@ public class RenderSessionImpl extends RenderAction<SessionParams> {
|
|||||||
return mSystemViewInfoList;
|
return mSystemViewInfoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<Object, PropertiesMap> getDefaultProperties() {
|
||||||
|
return getContext().getDefaultProperties();
|
||||||
|
}
|
||||||
|
|
||||||
public void setScene(RenderSession session) {
|
public void setScene(RenderSession session) {
|
||||||
mScene = session;
|
mScene = session;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user