summaryrefslogtreecommitdiffstats
path: root/tools/layoutlib
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2011-07-19 15:10:23 -0700
committerXavier Ducrohet <xav@android.com>2011-07-19 15:10:23 -0700
commitaf64556de0064eeb5a4d4e6d634c3f074f5f40ce (patch)
treeaaeb6dba4b713c2d7a21621d00555d823104316c /tools/layoutlib
parentf2cc48fe8bea26bd07cb943b8308a19336536867 (diff)
downloadframeworks_base-af64556de0064eeb5a4d4e6d634c3f074f5f40ce.zip
frameworks_base-af64556de0064eeb5a4d4e6d634c3f074f5f40ce.tar.gz
frameworks_base-af64556de0064eeb5a4d4e6d634c3f074f5f40ce.tar.bz2
Layoutlib: misc fix + start of AndroidBidi support.
Change-Id: If2ce0b683da8cce01679322d503eed8dd474e521
Diffstat (limited to 'tools/layoutlib')
-rw-r--r--tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java27
-rw-r--r--tools/layoutlib/bridge/src/android/text/AndroidBidi_Delegate.java37
-rw-r--r--tools/layoutlib/bridge/src/android/view/inputmethod/InputMethodManager_Delegate.java13
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeIInputMethodManager.java6
-rw-r--r--tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java1
5 files changed, 57 insertions, 27 deletions
diff --git a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
index b4448a9..8e3ed93 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
@@ -1093,33 +1093,6 @@ public final class Canvas_Delegate {
}
@LayoutlibDelegate
- /*package*/ static void native_drawTextWithGlyphs(int nativeCanvas, char[] text,
- int index, int count, float x,
- float y, int flags, int paint) {
- native_drawText(nativeCanvas, text, index, count, x, y, flags, paint);
- }
-
- @LayoutlibDelegate
- /*package*/ static void native_drawTextWithGlyphs(int nativeCanvas, String text,
- int start, int end, float x,
- float y, int flags, int paint) {
- int count = end - start;
- char[] buffer = TemporaryBuffer.obtain(count);
- TextUtils.getChars(text, start, end, buffer, 0);
-
- native_drawText(nativeCanvas, text, 0, count, x, y, flags, paint);
- }
-
- @LayoutlibDelegate
- /*package*/ static void native_drawGlyphs(int nativeCanvas, char[] glyphs,
- int index, int count, float x,
- float y, int flags, int paint) {
- // FIXME
- Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
- "Canvas.drawGlyphs is not supported.", null, null /*data*/);
- }
-
- @LayoutlibDelegate
/*package*/ static void native_drawPosText(int nativeCanvas,
char[] text, int index,
int count, float[] pos,
diff --git a/tools/layoutlib/bridge/src/android/text/AndroidBidi_Delegate.java b/tools/layoutlib/bridge/src/android/text/AndroidBidi_Delegate.java
new file mode 100644
index 0000000..52b8f34
--- /dev/null
+++ b/tools/layoutlib/bridge/src/android/text/AndroidBidi_Delegate.java
@@ -0,0 +1,37 @@
+/*
+ * 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 android.text;
+
+import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
+
+
+/**
+ * Delegate used to provide new implementation for the native methods of {@link AndroidBidi}
+ *
+ * Through the layoutlib_create tool, the original methods of AndroidBidi have been replaced
+ * by calls to methods of the same name in this delegate class.
+ *
+ */
+public class AndroidBidi_Delegate {
+
+ @LayoutlibDelegate
+ /*package*/ static int runBidi(int dir, char[] chs, byte[] chInfo, int n, boolean haveInfo) {
+ // return the equivalent of Layout.DIR_LEFT_TO_RIGHT
+ // TODO: actually figure the direction.
+ return 0;
+ }
+}
diff --git a/tools/layoutlib/bridge/src/android/view/inputmethod/InputMethodManager_Delegate.java b/tools/layoutlib/bridge/src/android/view/inputmethod/InputMethodManager_Delegate.java
index ec7a67e..f056040 100644
--- a/tools/layoutlib/bridge/src/android/view/inputmethod/InputMethodManager_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/view/inputmethod/InputMethodManager_Delegate.java
@@ -19,6 +19,7 @@ package android.view.inputmethod;
import com.android.layoutlib.bridge.android.BridgeIInputMethodManager;
import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
+import android.content.Context;
import android.os.Looper;
@@ -44,6 +45,18 @@ public class InputMethodManager_Delegate {
mainLooper);
}
return InputMethodManager.mInstance;
+ }
+
+ @LayoutlibDelegate
+ /*package*/ static InputMethodManager getInstance(Context context) {
+ synchronized (InputMethodManager.mInstanceSync) {
+ if (InputMethodManager.mInstance != null) {
+ return InputMethodManager.mInstance;
+ }
+ InputMethodManager.mInstance = new InputMethodManager(new BridgeIInputMethodManager(),
+ Looper.myLooper());
+ }
+ return InputMethodManager.mInstance;
}
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeIInputMethodManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeIInputMethodManager.java
index 2519ebc..23e0ca1 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeIInputMethodManager.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeIInputMethodManager.java
@@ -188,4 +188,10 @@ public class BridgeIInputMethodManager implements IInputMethodManager {
return null;
}
+ public boolean setAdditionalInputMethodSubtypes(IBinder arg0, InputMethodSubtype[] arg1)
+ throws RemoteException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
}
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 df7e04f..93a35cc 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
@@ -155,6 +155,7 @@ public final class CreateInfo implements ICreateInfo {
"android.graphics.Typeface",
"android.graphics.Xfermode",
"android.os.SystemClock",
+ "android.text.AndroidBidi",
"android.util.FloatMath",
"android.view.Display",
"libcore.icu.ICU",