mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Use theme color for swipe trail
This commit is contained in:
parent
43984a6a76
commit
768accda75
@ -250,7 +250,7 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
|
|||||||
mainKeyboardViewAttr);
|
mainKeyboardViewAttr);
|
||||||
mGestureFloatingTextDrawingPreview.setDrawingView(drawingPreviewPlacerView);
|
mGestureFloatingTextDrawingPreview.setDrawingView(drawingPreviewPlacerView);
|
||||||
|
|
||||||
mGestureTrailsDrawingPreview = new GestureTrailsDrawingPreview(mainKeyboardViewAttr);
|
mGestureTrailsDrawingPreview = new GestureTrailsDrawingPreview(mainKeyboardViewAttr, mDrawableProvider);
|
||||||
mGestureTrailsDrawingPreview.setDrawingView(drawingPreviewPlacerView);
|
mGestureTrailsDrawingPreview.setDrawingView(drawingPreviewPlacerView);
|
||||||
|
|
||||||
mSlidingKeyInputDrawingPreview = new SlidingKeyInputDrawingPreview(mainKeyboardViewAttr);
|
mSlidingKeyInputDrawingPreview = new SlidingKeyInputDrawingPreview(mainKeyboardViewAttr);
|
||||||
|
@ -19,6 +19,7 @@ package org.futo.inputmethod.keyboard.internal;
|
|||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
|
|
||||||
import org.futo.inputmethod.latin.R;
|
import org.futo.inputmethod.latin.R;
|
||||||
|
import org.futo.inputmethod.latin.uix.DynamicThemeProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class holds parameters to control how a gesture trail is drawn and animated on the screen.
|
* This class holds parameters to control how a gesture trail is drawn and animated on the screen.
|
||||||
@ -49,9 +50,11 @@ final class GestureTrailDrawingParams {
|
|||||||
|
|
||||||
public final int mTrailLingerDuration;
|
public final int mTrailLingerDuration;
|
||||||
|
|
||||||
public GestureTrailDrawingParams(final TypedArray mainKeyboardViewAttr) {
|
public GestureTrailDrawingParams(final TypedArray mainKeyboardViewAttr, DynamicThemeProvider provider) {
|
||||||
mTrailColor = mainKeyboardViewAttr.getColor(
|
mTrailColor = DynamicThemeProvider.Companion.getColorOrDefault(
|
||||||
R.styleable.MainKeyboardView_gestureTrailColor, 0);
|
R.styleable.MainKeyboardView_gestureTrailColor, 0,
|
||||||
|
mainKeyboardViewAttr, provider
|
||||||
|
);
|
||||||
mTrailStartWidth = mainKeyboardViewAttr.getDimension(
|
mTrailStartWidth = mainKeyboardViewAttr.getDimension(
|
||||||
R.styleable.MainKeyboardView_gestureTrailStartWidth, 0.0f);
|
R.styleable.MainKeyboardView_gestureTrailStartWidth, 0.0f);
|
||||||
mTrailEndWidth = mainKeyboardViewAttr.getDimension(
|
mTrailEndWidth = mainKeyboardViewAttr.getDimension(
|
||||||
|
@ -28,6 +28,7 @@ import android.os.Handler;
|
|||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
|
|
||||||
import org.futo.inputmethod.keyboard.PointerTracker;
|
import org.futo.inputmethod.keyboard.PointerTracker;
|
||||||
|
import org.futo.inputmethod.latin.uix.DynamicThemeProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw preview graphics of multiple gesture trails during gesture input.
|
* Draw preview graphics of multiple gesture trails during gesture input.
|
||||||
@ -47,8 +48,8 @@ public final class GestureTrailsDrawingPreview extends AbstractDrawingPreview im
|
|||||||
|
|
||||||
private final Handler mDrawingHandler = new Handler();
|
private final Handler mDrawingHandler = new Handler();
|
||||||
|
|
||||||
public GestureTrailsDrawingPreview(final TypedArray mainKeyboardViewAttr) {
|
public GestureTrailsDrawingPreview(final TypedArray mainKeyboardViewAttr, DynamicThemeProvider provider) {
|
||||||
mDrawingParams = new GestureTrailDrawingParams(mainKeyboardViewAttr);
|
mDrawingParams = new GestureTrailDrawingParams(mainKeyboardViewAttr, provider);
|
||||||
final Paint gesturePaint = new Paint();
|
final Paint gesturePaint = new Paint();
|
||||||
gesturePaint.setAntiAlias(true);
|
gesturePaint.setAntiAlias(true);
|
||||||
gesturePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
|
gesturePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
|
||||||
|
@ -193,6 +193,7 @@ class BasicThemeProvider(val context: Context, val overrideColorScheme: ColorSch
|
|||||||
colors[R.styleable.Keyboard_Key_keyShiftedLetterHintActivatedColor] = onBackgroundHalf
|
colors[R.styleable.Keyboard_Key_keyShiftedLetterHintActivatedColor] = onBackgroundHalf
|
||||||
colors[R.styleable.Keyboard_Key_keyPreviewTextColor] = onSecondary
|
colors[R.styleable.Keyboard_Key_keyPreviewTextColor] = onSecondary
|
||||||
colors[R.styleable.MainKeyboardView_languageOnSpacebarTextColor] = onBackgroundHalf
|
colors[R.styleable.MainKeyboardView_languageOnSpacebarTextColor] = onBackgroundHalf
|
||||||
|
colors[R.styleable.MainKeyboardView_gestureTrailColor] = primary
|
||||||
|
|
||||||
val overrideDrawable: (Int, Int, Int) -> Unit = { a, b, color ->
|
val overrideDrawable: (Int, Int, Int) -> Unit = { a, b, color ->
|
||||||
drawables[a] = AppCompatResources.getDrawable(
|
drawables[a] = AppCompatResources.getDrawable(
|
||||||
|
Loading…
Reference in New Issue
Block a user