am 477687c1
: Merge "Fix SDK layout rendering in Eclipse." into jb-mr1-dev
* commit '477687c1eb1919c54e2bffba2a740df3b4af6668': Fix SDK layout rendering in Eclipse.
This commit is contained in:
@ -66,7 +66,7 @@ public class SystemClock_Delegate {
|
||||
* @return elapsed nanoseconds since boot.
|
||||
*/
|
||||
@LayoutlibDelegate
|
||||
/*package*/ static long elapsedRealtimeNano() {
|
||||
/*package*/ static long elapsedRealtimeNanos() {
|
||||
return System.nanoTime() - sBootTimeNano;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2012 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 android.view;
|
||||
|
||||
import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
|
||||
|
||||
/**
|
||||
* Delegate used to provide new implementation of a select few methods of {@link Choreographer}
|
||||
*
|
||||
* Through the layoutlib_create tool, the original methods of Choreographer have been
|
||||
* replaced by calls to methods of the same name in this delegate class.
|
||||
*
|
||||
*/
|
||||
public class Choreographer_Delegate {
|
||||
|
||||
@LayoutlibDelegate
|
||||
public static float getRefreshRate() {
|
||||
return 60.f;
|
||||
}
|
||||
}
|
@ -16,11 +16,8 @@
|
||||
|
||||
package android.view;
|
||||
|
||||
import com.android.layoutlib.bridge.android.BridgeWindowManager;
|
||||
import com.android.layoutlib.bridge.impl.RenderAction;
|
||||
import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
|
||||
|
||||
import android.os.RemoteException;
|
||||
|
||||
/**
|
||||
* Delegate used to provide new implementation of a select few methods of {@link Display}
|
||||
@ -31,4 +28,9 @@ import android.os.RemoteException;
|
||||
*/
|
||||
public class Display_Delegate {
|
||||
|
||||
@LayoutlibDelegate
|
||||
static void updateDisplayInfoLocked(Display theDisplay) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.layoutlib.bridge.android;
|
||||
package android.view;
|
||||
|
||||
import com.android.internal.view.IInputContext;
|
||||
import com.android.internal.view.IInputMethodClient;
|
||||
@ -28,7 +28,6 @@ import android.os.IRemoteCallback;
|
||||
import android.os.RemoteException;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Display;
|
||||
import android.view.Display_Delegate;
|
||||
import android.view.Gravity;
|
||||
import android.view.IApplicationToken;
|
||||
import android.view.IDisplayContentChangeListener;
|
||||
@ -45,16 +44,21 @@ import java.util.List;
|
||||
* Basic implementation of {@link IWindowManager} so that {@link Display} (and
|
||||
* {@link Display_Delegate}) can return a valid instance.
|
||||
*/
|
||||
public class BridgeWindowManager implements IWindowManager {
|
||||
public class IWindowManagerImpl implements IWindowManager {
|
||||
|
||||
private final Configuration mConfig;
|
||||
private final DisplayMetrics mMetrics;
|
||||
private final int mRotation;
|
||||
private final boolean mHasSystemNavBar;
|
||||
private final boolean mHasNavigationBar;
|
||||
|
||||
public BridgeWindowManager(Configuration config, DisplayMetrics metrics, int rotation) {
|
||||
public IWindowManagerImpl(Configuration config, DisplayMetrics metrics, int rotation,
|
||||
boolean hasSystemNavBar, boolean hasNavigationBar) {
|
||||
mConfig = config;
|
||||
mMetrics = metrics;
|
||||
mRotation = rotation;
|
||||
mHasSystemNavBar = hasSystemNavBar;
|
||||
mHasNavigationBar = hasNavigationBar;
|
||||
}
|
||||
|
||||
// custom API.
|
||||
@ -70,14 +74,18 @@ public class BridgeWindowManager implements IWindowManager {
|
||||
return mRotation;
|
||||
}
|
||||
|
||||
// ---- unused implementation of IWindowManager ----
|
||||
@Override
|
||||
public boolean hasNavigationBar() {
|
||||
return mHasNavigationBar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSystemNavBar() throws RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
return mHasSystemNavBar;
|
||||
}
|
||||
|
||||
// ---- unused implementation of IWindowManager ----
|
||||
|
||||
@Override
|
||||
public void addAppToken(int arg0, IApplicationToken arg1, int arg2, int arg3, boolean arg4,
|
||||
boolean arg5)
|
||||
@ -434,11 +442,6 @@ public class BridgeWindowManager implements IWindowManager {
|
||||
public void dismissKeyguard() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNavigationBar() {
|
||||
return false; // should this return something else?
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lockNow(Bundle options) {
|
||||
// TODO Auto-generated method stub
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2012 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 android.view;
|
||||
|
||||
import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
|
||||
|
||||
/**
|
||||
* Delegate used to provide new implementation of a select few methods of
|
||||
* {@link WindowManagerGlobal}
|
||||
*
|
||||
* Through the layoutlib_create tool, the original methods of WindowManagerGlobal have been
|
||||
* replaced by calls to methods of the same name in this delegate class.
|
||||
*
|
||||
*/
|
||||
public class WindowManagerGlobal_Delegate {
|
||||
|
||||
private static IWindowManager sService;
|
||||
|
||||
@LayoutlibDelegate
|
||||
public static IWindowManager getWindowManagerService() {
|
||||
return sService;
|
||||
}
|
||||
|
||||
// ---- internal implementation stuff ----
|
||||
|
||||
public static void setWindowManagerService(IWindowManager service) {
|
||||
sService = service;
|
||||
}
|
||||
}
|
@ -25,6 +25,7 @@ import com.android.ide.common.rendering.api.ResourceValue;
|
||||
import com.android.ide.common.rendering.api.StyleResourceValue;
|
||||
import com.android.layoutlib.bridge.Bridge;
|
||||
import com.android.layoutlib.bridge.BridgeConstants;
|
||||
import com.android.layoutlib.bridge.android.view.WindowManagerImpl;
|
||||
import com.android.layoutlib.bridge.impl.ParserFactory;
|
||||
import com.android.layoutlib.bridge.impl.Stack;
|
||||
import com.android.resources.ResourceType;
|
||||
@ -68,9 +69,9 @@ import android.util.TypedValue;
|
||||
import android.view.BridgeInflater;
|
||||
import android.view.CompatibilityInfoHolder;
|
||||
import android.view.Display;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.view.textservice.TextServicesManager;
|
||||
|
||||
import java.io.File;
|
||||
@ -98,7 +99,7 @@ public final class BridgeContext extends Context {
|
||||
private final Configuration mConfig;
|
||||
private final ApplicationInfo mApplicationInfo;
|
||||
private final IProjectCallback mProjectCallback;
|
||||
private final BridgeWindowManager mIWindowManager;
|
||||
private final WindowManager mWindowManager;
|
||||
|
||||
private Resources.Theme mTheme;
|
||||
|
||||
@ -139,10 +140,10 @@ public final class BridgeContext extends Context {
|
||||
mRenderResources = renderResources;
|
||||
mConfig = config;
|
||||
|
||||
mIWindowManager = new BridgeWindowManager(mConfig, metrics, Surface.ROTATION_0);
|
||||
|
||||
mApplicationInfo = new ApplicationInfo();
|
||||
mApplicationInfo.targetSdkVersion = targetSdkVersion;
|
||||
|
||||
mWindowManager = new WindowManagerImpl(mMetrics);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -198,14 +199,14 @@ public final class BridgeContext extends Context {
|
||||
return mRenderResources;
|
||||
}
|
||||
|
||||
public BridgeWindowManager getIWindowManager() {
|
||||
return mIWindowManager;
|
||||
}
|
||||
|
||||
public Map<String, String> getDefaultPropMap(Object key) {
|
||||
return mDefaultPropMaps.get(key);
|
||||
}
|
||||
|
||||
public Configuration getConfiguration() {
|
||||
return mConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a parser to the stack.
|
||||
* @param parser the parser to add.
|
||||
@ -431,10 +432,8 @@ public final class BridgeContext extends Context {
|
||||
return TextServicesManager.getInstance();
|
||||
}
|
||||
|
||||
// AutoCompleteTextView and MultiAutoCompleteTextView want a window
|
||||
// service. We don't have any but it's not worth an exception.
|
||||
if (WINDOW_SERVICE.equals(service)) {
|
||||
return null;
|
||||
return mWindowManager;
|
||||
}
|
||||
|
||||
// needed by SearchView
|
||||
|
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2012 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.view;
|
||||
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Display;
|
||||
import android.view.DisplayInfo;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
public class WindowManagerImpl implements WindowManager {
|
||||
|
||||
private final DisplayMetrics mMetrics;
|
||||
private final Display mDisplay;
|
||||
|
||||
public WindowManagerImpl(DisplayMetrics metrics) {
|
||||
mMetrics = metrics;
|
||||
|
||||
DisplayInfo info = new DisplayInfo();
|
||||
info.logicalHeight = mMetrics.heightPixels;
|
||||
info.logicalWidth = mMetrics.widthPixels;
|
||||
mDisplay = new Display(null, Display.DEFAULT_DISPLAY, info, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Display getDefaultDisplay() {
|
||||
return mDisplay;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addView(View arg0, android.view.ViewGroup.LayoutParams arg1) {
|
||||
// pass
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeView(View arg0) {
|
||||
// pass
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateViewLayout(View arg0, android.view.ViewGroup.LayoutParams arg1) {
|
||||
// pass
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void removeViewImmediate(View arg0) {
|
||||
// pass
|
||||
}
|
||||
}
|
@ -68,11 +68,15 @@ import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.AttachInfo_Accessor;
|
||||
import android.view.BridgeInflater;
|
||||
import android.view.IWindowManagerImpl;
|
||||
import android.view.IWindowManager;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.view.View.MeasureSpec;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.view.ViewGroup.MarginLayoutParams;
|
||||
import android.view.WindowManagerGlobal_Delegate;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AbsSpinner;
|
||||
import android.widget.AdapterView;
|
||||
@ -185,6 +189,14 @@ public class RenderSessionImpl extends RenderAction<SessionParams> {
|
||||
findActionBar(resources, metrics);
|
||||
findSystemBar(resources, metrics);
|
||||
|
||||
// FIXME: find those out, and possibly add them to the render params
|
||||
boolean hasSystemNavBar = true;
|
||||
boolean hasNavigationBar = true;
|
||||
IWindowManager iwm = new IWindowManagerImpl(getContext().getConfiguration(),
|
||||
metrics, Surface.ROTATION_0,
|
||||
hasSystemNavBar, hasNavigationBar);
|
||||
WindowManagerGlobal_Delegate.setWindowManagerService(iwm);
|
||||
|
||||
// build the inflater and parser.
|
||||
mInflater = new BridgeInflater(context, params.getProjectCallback());
|
||||
context.setBridgeInflater(mInflater);
|
||||
|
@ -110,11 +110,13 @@ public final class CreateInfo implements ICreateInfo {
|
||||
"android.os.Handler#sendMessageAtTime",
|
||||
"android.os.HandlerThread#run",
|
||||
"android.os.Build#getString",
|
||||
"android.view.Display#getWindowManager",
|
||||
"android.view.Choreographer#getRefreshRate",
|
||||
"android.view.Display#updateDisplayInfoLocked",
|
||||
"android.view.LayoutInflater#rInflate",
|
||||
"android.view.LayoutInflater#parseInclude",
|
||||
"android.view.View#isInEditMode",
|
||||
"android.view.ViewRootImpl#isInTouchMode",
|
||||
"android.view.WindowManagerGlobal#getWindowManagerService",
|
||||
"android.view.inputmethod.InputMethodManager#getInstance",
|
||||
"com.android.internal.util.XmlUtils#convertValueToInt",
|
||||
"com.android.internal.textservice.ITextServicesManager$Stub#asInterface",
|
||||
|
Reference in New Issue
Block a user