diff options
Diffstat (limited to 'tools/layoutlib/bridge/src')
9 files changed, 125 insertions, 3 deletions
diff --git a/tools/layoutlib/bridge/src/android/content/res/Resources_Theme_Delegate.java b/tools/layoutlib/bridge/src/android/content/res/Resources_Theme_Delegate.java index 413894b..c9d615c 100644 --- a/tools/layoutlib/bridge/src/android/content/res/Resources_Theme_Delegate.java +++ b/tools/layoutlib/bridge/src/android/content/res/Resources_Theme_Delegate.java @@ -25,7 +25,7 @@ import android.util.AttributeSet; import android.util.TypedValue; /** - * Delegate used to provide new implementation of a select few methods of {@link Theme} + * Delegate used to provide new implementation of a select few methods of {@link Resources$Theme} * * Through the layoutlib_create tool, the original methods of Theme have been replaced * by calls to methods of the same name in this delegate class. diff --git a/tools/layoutlib/bridge/src/android/graphics/Typeface_Accessor.java b/tools/layoutlib/bridge/src/android/graphics/Typeface_Accessor.java index 2745770..adad2ac 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Typeface_Accessor.java +++ b/tools/layoutlib/bridge/src/android/graphics/Typeface_Accessor.java @@ -16,6 +16,9 @@ package android.graphics; +/** + * Class allowing access to package-protected methods/fields. + */ public class Typeface_Accessor { public static void resetDefaults() { diff --git a/tools/layoutlib/bridge/src/android/os/Looper_Accessor.java b/tools/layoutlib/bridge/src/android/os/Looper_Accessor.java index ad95fcc..2961f97 100644 --- a/tools/layoutlib/bridge/src/android/os/Looper_Accessor.java +++ b/tools/layoutlib/bridge/src/android/os/Looper_Accessor.java @@ -15,6 +15,9 @@ */ package android.os; +/** + * Class allowing access to package-protected methods/fields. + */ public class Looper_Accessor { public static void cleanupThread() { diff --git a/tools/layoutlib/bridge/src/android/view/AttachInfo_Accessor.java b/tools/layoutlib/bridge/src/android/view/AttachInfo_Accessor.java index e3778b1..96de51c 100644 --- a/tools/layoutlib/bridge/src/android/view/AttachInfo_Accessor.java +++ b/tools/layoutlib/bridge/src/android/view/AttachInfo_Accessor.java @@ -22,6 +22,9 @@ import com.android.layoutlib.bridge.android.BridgeWindowSession; import android.os.Handler; import android.view.View.AttachInfo; +/** + * Class allowing access to package-protected methods/fields. + */ public class AttachInfo_Accessor { public static void setAttachInfo(View view) { diff --git a/tools/layoutlib/bridge/src/android/view/Display_Delegate.java b/tools/layoutlib/bridge/src/android/view/Display_Delegate.java index 9732530..8868c65 100644 --- a/tools/layoutlib/bridge/src/android/view/Display_Delegate.java +++ b/tools/layoutlib/bridge/src/android/view/Display_Delegate.java @@ -47,14 +47,14 @@ public class Display_Delegate { @LayoutlibDelegate /** @hide special for when we are faking the screen size. */ - /*package*/ static int getRawWidth(Display theDisplay) { + /*package*/ static int getRawWidthNative(Display theDisplay) { // same as real since we're not faking compatibility mode. return RenderAction.getCurrentContext().getIWindowManager().getMetrics().widthPixels; } @LayoutlibDelegate /** @hide special for when we are faking the screen size. */ - /*package*/ static int getRawHeight(Display theDisplay) { + /*package*/ static int getRawHeightNative(Display theDisplay) { // same as real since we're not faking compatibility mode. return RenderAction.getCurrentContext().getIWindowManager().getMetrics().heightPixels; } diff --git a/tools/layoutlib/bridge/src/android/view/ViewConfiguration_Accessor.java b/tools/layoutlib/bridge/src/android/view/ViewConfiguration_Accessor.java index 01db34e..c3533e0 100644 --- a/tools/layoutlib/bridge/src/android/view/ViewConfiguration_Accessor.java +++ b/tools/layoutlib/bridge/src/android/view/ViewConfiguration_Accessor.java @@ -16,6 +16,9 @@ package android.view; +/** + * Class allowing access to package-protected methods/fields. + */ public class ViewConfiguration_Accessor { public static void clearConfigurations() { diff --git a/tools/layoutlib/bridge/src/android/view/inputmethod/InputMethodManager_Accessor.java b/tools/layoutlib/bridge/src/android/view/inputmethod/InputMethodManager_Accessor.java index 875336a..7a6e52e 100644 --- a/tools/layoutlib/bridge/src/android/view/inputmethod/InputMethodManager_Accessor.java +++ b/tools/layoutlib/bridge/src/android/view/inputmethod/InputMethodManager_Accessor.java @@ -16,6 +16,9 @@ package android.view.inputmethod; +/** + * Class allowing access to package-protected methods/fields. + */ public class InputMethodManager_Accessor { public static void resetInstance() { diff --git a/tools/layoutlib/bridge/src/com/android/internal/textservice/ITextServicesManager_Stub_Delegate.java b/tools/layoutlib/bridge/src/com/android/internal/textservice/ITextServicesManager_Stub_Delegate.java new file mode 100644 index 0000000..9efdcaf --- /dev/null +++ b/tools/layoutlib/bridge/src/com/android/internal/textservice/ITextServicesManager_Stub_Delegate.java @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2011 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.internal.textservice; + +import com.android.tools.layoutlib.annotations.LayoutlibDelegate; + +import android.os.Bundle; +import android.os.IBinder; +import android.os.RemoteException; +import android.view.textservice.SpellCheckerInfo; +import android.view.textservice.SpellCheckerSubtype; + + +/** + * Delegate used to provide new implementation of a select few methods of + * {@link ITextServicesManager$Stub} + * + * Through the layoutlib_create tool, the original methods of Stub have been replaced + * by calls to methods of the same name in this delegate class. + * + */ +public class ITextServicesManager_Stub_Delegate { + + @LayoutlibDelegate + public static ITextServicesManager asInterface(IBinder obj) { + // ignore the obj and return a fake interface implementation + return new FakeTextServicesManager(); + } + + private static class FakeTextServicesManager implements ITextServicesManager { + + public void finishSpellCheckerService(ISpellCheckerSessionListener arg0) + throws RemoteException { + // TODO Auto-generated method stub + + } + + public SpellCheckerInfo getCurrentSpellChecker(String arg0) throws RemoteException { + // TODO Auto-generated method stub + return null; + } + + public SpellCheckerSubtype getCurrentSpellCheckerSubtype(String arg0, boolean arg1) + throws RemoteException { + // TODO Auto-generated method stub + return null; + } + + public SpellCheckerInfo[] getEnabledSpellCheckers() throws RemoteException { + // TODO Auto-generated method stub + return null; + } + + public void getSpellCheckerService(String arg0, String arg1, + ITextServicesSessionListener arg2, ISpellCheckerSessionListener arg3, Bundle arg4) + throws RemoteException { + // TODO Auto-generated method stub + + } + + public boolean isSpellCheckerEnabled() throws RemoteException { + // TODO Auto-generated method stub + return false; + } + + public void setCurrentSpellChecker(String arg0, String arg1) throws RemoteException { + // TODO Auto-generated method stub + + } + + public void setCurrentSpellCheckerSubtype(String arg0, int arg1) throws RemoteException { + // TODO Auto-generated method stub + + } + + public void setSpellCheckerEnabled(boolean arg0) throws RemoteException { + // TODO Auto-generated method stub + + } + + public IBinder asBinder() { + // TODO Auto-generated method stub + return null; + } + + } + } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java index 0453a5e..fbbcbc1 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java @@ -67,6 +67,7 @@ import android.view.BridgeInflater; import android.view.Surface; import android.view.View; import android.view.ViewGroup; +import android.view.textservice.TextServicesManager; import java.io.File; import java.io.FileInputStream; @@ -414,6 +415,11 @@ public final class BridgeContext extends Context { return mBridgeInflater; } + if (TEXT_SERVICES_MANAGER_SERVICE.equals(service)) { + // we need to return a valid service to avoid NPE + 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)) { |
