diff options
author | Xavier Ducrohet <xav@android.com> | 2012-03-23 16:07:23 -0700 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2012-03-23 16:07:23 -0700 |
commit | 22f700a1b8fb9d2ac7b261e30a46a040928c23bc (patch) | |
tree | 8c56dc423da3c3ec1e443f090c8426243265de48 /tools | |
parent | 0aa4713e47a53377720a043cf1b043ce31cb73da (diff) | |
download | frameworks_base-22f700a1b8fb9d2ac7b261e30a46a040928c23bc.zip frameworks_base-22f700a1b8fb9d2ac7b261e30a46a040928c23bc.tar.gz frameworks_base-22f700a1b8fb9d2ac7b261e30a46a040928c23bc.tar.bz2 |
Add Delegate for ViewRootImpl#isInTouchMode to prevent IPC call in Eclipse.
Also fix some new/removed method from BitmapFactory.
Change-Id: I606bd8bee6ff1e2c6c9472b4672175bfdaff45de
Diffstat (limited to 'tools')
3 files changed, 49 insertions, 4 deletions
diff --git a/tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java index 945b3cd..5256b58 100644 --- a/tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java @@ -85,15 +85,18 @@ import java.io.InputStream; // ------ Native Delegates ------ @LayoutlibDelegate - /*package*/ static void nativeSetDefaultConfig(int nativeConfig) { - // pass + /*package*/ static Bitmap nativeDecodeStream(InputStream is, byte[] storage, + Rect padding, Options opts) { + return nativeDecodeStream(is, storage, padding, opts, false, 1.f); } @LayoutlibDelegate - /*package*/ static Bitmap nativeDecodeStream(InputStream is, byte[] storage, - Rect padding, Options opts) { + /*package*/ static Bitmap nativeDecodeStream(InputStream is, byte[] storage, + Rect padding, Options opts, boolean applyScale, float scale) { Bitmap bm = null; + //TODO support rescaling + Density density = Density.MEDIUM; if (opts != null) { density = Density.getEnum(opts.inDensity); @@ -147,6 +150,13 @@ import java.io.InputStream; } @LayoutlibDelegate + /*package*/ static Bitmap nativeDecodeAsset(int asset, Rect padding, Options opts, + boolean applyScale, float scale) { + opts.inBitmap = null; + return null; + } + + @LayoutlibDelegate /*package*/ static Bitmap nativeDecodeByteArray(byte[] data, int offset, int length, Options opts) { opts.inBitmap = null; diff --git a/tools/layoutlib/bridge/src/android/view/ViewRootImpl_Delegate.java b/tools/layoutlib/bridge/src/android/view/ViewRootImpl_Delegate.java new file mode 100644 index 0000000..14b84ef --- /dev/null +++ b/tools/layoutlib/bridge/src/android/view/ViewRootImpl_Delegate.java @@ -0,0 +1,34 @@ +/* + * 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 ViewRootImpl} + * + * Through the layoutlib_create tool, the original methods of ViewRootImpl have been replaced + * by calls to methods of the same name in this delegate class. + * + */ +public class ViewRootImpl_Delegate { + + @LayoutlibDelegate + /*package*/ static boolean isInTouchMode() { + return false; // this allows displaying selection. + } +} diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java index 170cd6a..79e02c8 100644 --- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java +++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java @@ -114,6 +114,7 @@ public final class CreateInfo implements ICreateInfo { "android.view.LayoutInflater#rInflate", "android.view.LayoutInflater#parseInclude", "android.view.View#isInEditMode", + "android.view.ViewRootImpl#isInTouchMode", "android.view.inputmethod.InputMethodManager#getInstance", "android.util.Log#println_native", "com.android.internal.util.XmlUtils#convertValueToInt", |