am 52876bbe
: Remove unnecessary setLayerType() calls
* commit '52876bbefd774e8647910f73a2e4c17ac4e6bf5c': Remove unnecessary setLayerType() calls
This commit is contained in:
commit
0a856c2d23
4 changed files with 16 additions and 4 deletions
|
@ -314,10 +314,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
R.layout.input_view, null);
|
R.layout.input_view, null);
|
||||||
|
|
||||||
mKeyboardView = (MainKeyboardView) mCurrentInputView.findViewById(R.id.keyboard_view);
|
mKeyboardView = (MainKeyboardView) mCurrentInputView.findViewById(R.id.keyboard_view);
|
||||||
if (isHardwareAcceleratedDrawingEnabled) {
|
mKeyboardView.setHardwareAcceleratedDrawingEnabled(isHardwareAcceleratedDrawingEnabled);
|
||||||
mKeyboardView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
|
||||||
// TODO: Should use LAYER_TYPE_SOFTWARE when hardware acceleration is off?
|
|
||||||
}
|
|
||||||
mKeyboardView.setKeyboardActionListener(mLatinIME);
|
mKeyboardView.setKeyboardActionListener(mLatinIME);
|
||||||
|
|
||||||
// This always needs to be set since the accessibility state can
|
// This always needs to be set since the accessibility state can
|
||||||
|
|
|
@ -154,6 +154,12 @@ public class KeyboardView extends View {
|
||||||
Color.red(color), Color.green(color), Color.blue(color));
|
Color.red(color), Color.green(color), Color.blue(color));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHardwareAcceleratedDrawingEnabled(final boolean enabled) {
|
||||||
|
if (!enabled) return;
|
||||||
|
// TODO: Should use LAYER_TYPE_SOFTWARE when hardware acceleration is off?
|
||||||
|
setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attaches a keyboard to this view. The keyboard can be switched at any time and the
|
* Attaches a keyboard to this view. The keyboard can be switched at any time and the
|
||||||
* view will re-layout itself to accommodate the keyboard.
|
* view will re-layout itself to accommodate the keyboard.
|
||||||
|
|
|
@ -512,6 +512,12 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||||
mKeyboardActionListener = KeyboardActionListener.EMPTY_LISTENER;
|
mKeyboardActionListener = KeyboardActionListener.EMPTY_LISTENER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setHardwareAcceleratedDrawingEnabled(final boolean enabled) {
|
||||||
|
super.setHardwareAcceleratedDrawingEnabled(enabled);
|
||||||
|
mPreviewPlacerView.setHardwareAcceleratedDrawingEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
private ObjectAnimator loadObjectAnimator(final int resId, final Object target) {
|
private ObjectAnimator loadObjectAnimator(final int resId, final Object target) {
|
||||||
if (resId == 0) {
|
if (resId == 0) {
|
||||||
// TODO: Stop returning null.
|
// TODO: Stop returning null.
|
||||||
|
|
|
@ -37,7 +37,10 @@ public final class PreviewPlacerView extends RelativeLayout {
|
||||||
public PreviewPlacerView(final Context context, final AttributeSet attrs) {
|
public PreviewPlacerView(final Context context, final AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
setWillNotDraw(false);
|
setWillNotDraw(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHardwareAcceleratedDrawingEnabled(final boolean enabled) {
|
||||||
|
if (!enabled) return;
|
||||||
final Paint layerPaint = new Paint();
|
final Paint layerPaint = new Paint();
|
||||||
layerPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));
|
layerPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));
|
||||||
setLayerType(LAYER_TYPE_HARDWARE, layerPaint);
|
setLayerType(LAYER_TYPE_HARDWARE, layerPaint);
|
||||||
|
|
Loading…
Reference in a new issue