Bug: 7017430
Change-Id: Ie46f02a934763c3b6d65d0d62a8239d80eaefabd
main
Tadashi G. Takaoka 2012-08-21 10:42:49 +09:00
parent 48643b0e0d
commit 8d0cf41f49
1 changed files with 15 additions and 3 deletions

View File

@ -30,6 +30,7 @@ import android.graphics.Typeface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Message; import android.os.Message;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray; import android.util.SparseArray;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -78,6 +79,8 @@ import java.util.HashSet;
* @attr ref R.styleable#KeyboardView_shadowRadius * @attr ref R.styleable#KeyboardView_shadowRadius
*/ */
public class KeyboardView extends View implements PointerTracker.DrawingProxy { public class KeyboardView extends View implements PointerTracker.DrawingProxy {
private static final String TAG = KeyboardView.class.getSimpleName();
// Miscellaneous constants // Miscellaneous constants
private static final int[] LONG_PRESSABLE_STATE_SET = { android.R.attr.state_long_pressable }; private static final int[] LONG_PRESSABLE_STATE_SET = { android.R.attr.state_long_pressable };
@ -932,10 +935,19 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
final int[] viewOrigin = new int[2]; final int[] viewOrigin = new int[2];
getLocationInWindow(viewOrigin); getLocationInWindow(viewOrigin);
mPreviewPlacerView.setOrigin(viewOrigin[0], viewOrigin[1]); mPreviewPlacerView.setOrigin(viewOrigin[0], viewOrigin[1]);
final ViewGroup windowContentView = final View rootView = getRootView();
(ViewGroup)getRootView().findViewById(android.R.id.content); if (rootView == null) {
Log.w(TAG, "Cannot find root view");
return;
}
final ViewGroup windowContentView = (ViewGroup)rootView.findViewById(android.R.id.content);
// Note: It'd be very weird if we get null by android.R.id.content.
if (windowContentView == null) {
Log.w(TAG, "Cannot find android.R.id.content view to add PreviewPlacerView");
} else {
windowContentView.addView(mPreviewPlacerView); windowContentView.addView(mPreviewPlacerView);
} }
}
public void showGestureFloatingPreviewText(String gestureFloatingPreviewText) { public void showGestureFloatingPreviewText(String gestureFloatingPreviewText) {
locatePreviewPlacerView(); locatePreviewPlacerView();