mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
am 9c968b62
: Move gesture related XML attribute to MainKeyboardView
* commit '9c968b62d1b4049959b7b7b0f05388c90e31b46e': Move gesture related XML attribute to MainKeyboardView
This commit is contained in:
commit
99b5393422
@ -60,24 +60,6 @@
|
||||
<attr name="verticalCorrection" format="dimension" />
|
||||
|
||||
<attr name="backgroundDimAlpha" format="integer" />
|
||||
|
||||
<!-- Attributes for PreviewPlacerView -->
|
||||
<attr name="gestureFloatingPreviewTextSize" format="dimension" />
|
||||
<attr name="gestureFloatingPreviewTextColor" format="color" />
|
||||
<attr name="gestureFloatingPreviewTextOffset" format="dimension" />
|
||||
<attr name="gestureFloatingPreviewColor" format="color" />
|
||||
<attr name="gestureFloatingPreviewHorizontalPadding" format="dimension" />
|
||||
<attr name="gestureFloatingPreviewVerticalPadding" format="dimension" />
|
||||
<attr name="gestureFloatingPreviewRoundRadius" format="dimension" />
|
||||
<!-- Delay after gesture trail starts fading out in millisecond. -->
|
||||
<attr name="gesturePreviewTrailFadeoutStartDelay" format="integer" />
|
||||
<!-- Duration while gesture preview trail is fading out in millisecond. -->
|
||||
<attr name="gesturePreviewTrailFadeoutDuration" format="integer" />
|
||||
<!-- Interval of updating gesture preview trail in millisecond. -->
|
||||
<attr name="gesturePreviewTrailUpdateInterval" format="integer" />
|
||||
<attr name="gesturePreviewTrailColor" format="color" />
|
||||
<attr name="gesturePreviewTrailStartWidth" format="dimension" />
|
||||
<attr name="gesturePreviewTrailEndWidth" format="dimension" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="MainKeyboardView">
|
||||
@ -125,8 +107,25 @@
|
||||
<attr name="moreKeysKeyboardLayout" format="reference" />
|
||||
<!-- More keys keyboard will shown at touched point. -->
|
||||
<attr name="showMoreKeysKeyboardAtTouchedPoint" format="boolean" />
|
||||
<!-- Delay after gesture trail starts fading out in millisecond. -->
|
||||
<attr name="gesturePreviewTrailFadeoutStartDelay" format="integer" />
|
||||
<!-- Duration while gesture preview trail is fading out in millisecond. -->
|
||||
<attr name="gesturePreviewTrailFadeoutDuration" format="integer" />
|
||||
<!-- Interval of updating gesture preview trail in millisecond. -->
|
||||
<attr name="gesturePreviewTrailUpdateInterval" format="integer" />
|
||||
<attr name="gesturePreviewTrailColor" format="color" />
|
||||
<attr name="gesturePreviewTrailStartWidth" format="dimension" />
|
||||
<attr name="gesturePreviewTrailEndWidth" format="dimension" />
|
||||
<!-- Delay after gesture input and gesture floating preview text dismissing in millisecond -->
|
||||
<attr name="gestureFloatingPreviewTextLingerTimeout" format="integer" />
|
||||
<!-- Attributes for GestureFloatingPreviewText -->
|
||||
<attr name="gestureFloatingPreviewTextSize" format="dimension" />
|
||||
<attr name="gestureFloatingPreviewTextColor" format="color" />
|
||||
<attr name="gestureFloatingPreviewTextOffset" format="dimension" />
|
||||
<attr name="gestureFloatingPreviewColor" format="color" />
|
||||
<attr name="gestureFloatingPreviewHorizontalPadding" format="dimension" />
|
||||
<attr name="gestureFloatingPreviewVerticalPadding" format="dimension" />
|
||||
<attr name="gestureFloatingPreviewRoundRadius" format="dimension" />
|
||||
<!-- Static threshold for gesture after fast typing (msec) -->
|
||||
<attr name="gestureStaticTimeThresholdAfterFastTyping" format="integer" />
|
||||
<!-- Static threshold for starting gesture detection (keyWidth%/sec) -->
|
||||
|
@ -57,22 +57,21 @@ public class GestureFloatingPreviewText extends AbstractDrawingPreview {
|
||||
|
||||
private static final char[] TEXT_HEIGHT_REFERENCE_CHAR = { 'M' };
|
||||
|
||||
public GesturePreviewTextParams(final TypedArray keyboardViewAttr) {
|
||||
// TODO: Move these XML attributes to MainKeyboardView
|
||||
mGesturePreviewTextSize = keyboardViewAttr.getDimensionPixelSize(
|
||||
R.styleable.KeyboardView_gestureFloatingPreviewTextSize, 0);
|
||||
mGesturePreviewTextColor = keyboardViewAttr.getColor(
|
||||
R.styleable.KeyboardView_gestureFloatingPreviewTextColor, 0);
|
||||
mGesturePreviewTextOffset = keyboardViewAttr.getDimensionPixelOffset(
|
||||
R.styleable.KeyboardView_gestureFloatingPreviewTextOffset, 0);
|
||||
mGesturePreviewColor = keyboardViewAttr.getColor(
|
||||
R.styleable.KeyboardView_gestureFloatingPreviewColor, 0);
|
||||
mGesturePreviewHorizontalPadding = keyboardViewAttr.getDimension(
|
||||
R.styleable.KeyboardView_gestureFloatingPreviewHorizontalPadding, 0.0f);
|
||||
mGesturePreviewVerticalPadding = keyboardViewAttr.getDimension(
|
||||
R.styleable.KeyboardView_gestureFloatingPreviewVerticalPadding, 0.0f);
|
||||
mGesturePreviewRoundRadius = keyboardViewAttr.getDimension(
|
||||
R.styleable.KeyboardView_gestureFloatingPreviewRoundRadius, 0.0f);
|
||||
public GesturePreviewTextParams(final TypedArray mainKeyboardViewAttr) {
|
||||
mGesturePreviewTextSize = mainKeyboardViewAttr.getDimensionPixelSize(
|
||||
R.styleable.MainKeyboardView_gestureFloatingPreviewTextSize, 0);
|
||||
mGesturePreviewTextColor = mainKeyboardViewAttr.getColor(
|
||||
R.styleable.MainKeyboardView_gestureFloatingPreviewTextColor, 0);
|
||||
mGesturePreviewTextOffset = mainKeyboardViewAttr.getDimensionPixelOffset(
|
||||
R.styleable.MainKeyboardView_gestureFloatingPreviewTextOffset, 0);
|
||||
mGesturePreviewColor = mainKeyboardViewAttr.getColor(
|
||||
R.styleable.MainKeyboardView_gestureFloatingPreviewColor, 0);
|
||||
mGesturePreviewHorizontalPadding = mainKeyboardViewAttr.getDimension(
|
||||
R.styleable.MainKeyboardView_gestureFloatingPreviewHorizontalPadding, 0.0f);
|
||||
mGesturePreviewVerticalPadding = mainKeyboardViewAttr.getDimension(
|
||||
R.styleable.MainKeyboardView_gestureFloatingPreviewVerticalPadding, 0.0f);
|
||||
mGesturePreviewRoundRadius = mainKeyboardViewAttr.getDimension(
|
||||
R.styleable.MainKeyboardView_gestureFloatingPreviewRoundRadius, 0.0f);
|
||||
|
||||
final Paint textPaint = new Paint();
|
||||
textPaint.setAntiAlias(true);
|
||||
|
@ -26,11 +26,11 @@ import com.android.inputmethod.latin.R;
|
||||
import com.android.inputmethod.latin.ResizableIntArray;
|
||||
|
||||
/*
|
||||
* @attr ref R.styleable#KeyboardView_gesturePreviewTrailFadeoutStartDelay
|
||||
* @attr ref R.styleable#KeyboardView_gesturePreviewTrailFadeoutDuration
|
||||
* @attr ref R.styleable#KeyboardView_gesturePreviewTrailUpdateInterval
|
||||
* @attr ref R.styleable#KeyboardView_gesturePreviewTrailColor
|
||||
* @attr ref R.styleable#KeyboardView_gesturePreviewTrailWidth
|
||||
* @attr ref R.styleable#MainKeyboardView_gesturePreviewTrailFadeoutStartDelay
|
||||
* @attr ref R.styleable#MainKeyboardView_gesturePreviewTrailFadeoutDuration
|
||||
* @attr ref R.styleable#MainKeyboardView_gesturePreviewTrailUpdateInterval
|
||||
* @attr ref R.styleable#MainKeyboardView_gesturePreviewTrailColor
|
||||
* @attr ref R.styleable#MainKeyboardView_gesturePreviewTrailWidth
|
||||
*/
|
||||
final class GesturePreviewTrail {
|
||||
private static final int DEFAULT_CAPACITY = GestureStrokeWithPreviewPoints.PREVIEW_CAPACITY;
|
||||
@ -53,21 +53,20 @@ final class GesturePreviewTrail {
|
||||
|
||||
public final int mTrailLingerDuration;
|
||||
|
||||
public Params(final TypedArray keyboardViewAttr) {
|
||||
// TODO: Move these XML attributes to MainKeyboardView
|
||||
mTrailColor = keyboardViewAttr.getColor(
|
||||
R.styleable.KeyboardView_gesturePreviewTrailColor, 0);
|
||||
mTrailStartWidth = keyboardViewAttr.getDimension(
|
||||
R.styleable.KeyboardView_gesturePreviewTrailStartWidth, 0.0f);
|
||||
mTrailEndWidth = keyboardViewAttr.getDimension(
|
||||
R.styleable.KeyboardView_gesturePreviewTrailEndWidth, 0.0f);
|
||||
mFadeoutStartDelay = keyboardViewAttr.getInt(
|
||||
R.styleable.KeyboardView_gesturePreviewTrailFadeoutStartDelay, 0);
|
||||
mFadeoutDuration = keyboardViewAttr.getInt(
|
||||
R.styleable.KeyboardView_gesturePreviewTrailFadeoutDuration, 0);
|
||||
public Params(final TypedArray mainKeyboardViewAttr) {
|
||||
mTrailColor = mainKeyboardViewAttr.getColor(
|
||||
R.styleable.MainKeyboardView_gesturePreviewTrailColor, 0);
|
||||
mTrailStartWidth = mainKeyboardViewAttr.getDimension(
|
||||
R.styleable.MainKeyboardView_gesturePreviewTrailStartWidth, 0.0f);
|
||||
mTrailEndWidth = mainKeyboardViewAttr.getDimension(
|
||||
R.styleable.MainKeyboardView_gesturePreviewTrailEndWidth, 0.0f);
|
||||
mFadeoutStartDelay = mainKeyboardViewAttr.getInt(
|
||||
R.styleable.MainKeyboardView_gesturePreviewTrailFadeoutStartDelay, 0);
|
||||
mFadeoutDuration = mainKeyboardViewAttr.getInt(
|
||||
R.styleable.MainKeyboardView_gesturePreviewTrailFadeoutDuration, 0);
|
||||
mTrailLingerDuration = mFadeoutStartDelay + mFadeoutDuration;
|
||||
mUpdateInterval = keyboardViewAttr.getInt(
|
||||
R.styleable.KeyboardView_gesturePreviewTrailUpdateInterval, 0);
|
||||
mUpdateInterval = mainKeyboardViewAttr.getInt(
|
||||
R.styleable.MainKeyboardView_gesturePreviewTrailUpdateInterval, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,13 +100,13 @@ public final class PreviewPlacerView extends RelativeLayout {
|
||||
super(context);
|
||||
setWillNotDraw(false);
|
||||
|
||||
final TypedArray keyboardViewAttr = context.obtainStyledAttributes(
|
||||
attrs, R.styleable.KeyboardView, defStyle, R.style.KeyboardView);
|
||||
final TypedArray mainKeyboardViewAttr = context.obtainStyledAttributes(
|
||||
attrs, R.styleable.MainKeyboardView, defStyle, R.style.MainKeyboardView);
|
||||
// TODO: mGestureFloatingPreviewText could be an instance of GestureFloatingPreviewText or
|
||||
// MultiGesturePreviewText, depending on the user's choice in the settings.
|
||||
mGestureFloatingPreviewText = new GestureFloatingPreviewText(keyboardViewAttr, context);
|
||||
mGesturePreviewTrailParams = new Params(keyboardViewAttr);
|
||||
keyboardViewAttr.recycle();
|
||||
mGestureFloatingPreviewText = new GestureFloatingPreviewText(mainKeyboardViewAttr, context);
|
||||
mGesturePreviewTrailParams = new Params(mainKeyboardViewAttr);
|
||||
mainKeyboardViewAttr.recycle();
|
||||
|
||||
mDrawingHandler = new DrawingHandler(this, mGesturePreviewTrailParams);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user