Merge "Add Delegate for ViewRootImpl#isInTouchMode to prevent IPC call in Eclipse."

This commit is contained in:
Xavier Ducrohet
2012-03-23 16:29:50 -07:00
committed by Android (Google) Code Review
3 changed files with 49 additions and 4 deletions

View File

@@ -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);
@@ -146,6 +149,13 @@ import java.io.InputStream;
return null;
}
@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) {

View File

@@ -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.
}
}

View File

@@ -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",