Fix shift key toggle indicator, fix sliding key color

This commit is contained in:
Aleksandras Kostarevas 2024-05-14 18:21:03 -05:00
parent d9ab17cc5e
commit b212a3bc83
4 changed files with 8 additions and 5 deletions

View File

@ -284,7 +284,7 @@ public class Key implements Comparable<Key> {
final int visualInsetsRight = Math.round(keyAttr.getFraction(
R.styleable.Keyboard_Key_visualInsetsRight, baseWidth, baseWidth, 0));
if(visualInsetsLeft > 0 || visualInsetsRight > 0) {
if((visualInsetsLeft > 0 || visualInsetsRight > 0) && mBackgroundType != BACKGROUND_TYPE_STICKY_ON) {
mBackgroundType = BACKGROUND_TYPE_FUNCTIONAL;
}

View File

@ -253,7 +253,7 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
mGestureTrailsDrawingPreview = new GestureTrailsDrawingPreview(mainKeyboardViewAttr, mDrawableProvider);
mGestureTrailsDrawingPreview.setDrawingView(drawingPreviewPlacerView);
mSlidingKeyInputDrawingPreview = new SlidingKeyInputDrawingPreview(mainKeyboardViewAttr);
mSlidingKeyInputDrawingPreview = new SlidingKeyInputDrawingPreview(mainKeyboardViewAttr, mDrawableProvider);
mSlidingKeyInputDrawingPreview.setDrawingView(drawingPreviewPlacerView);
mainKeyboardViewAttr.recycle();

View File

@ -24,6 +24,7 @@ import android.graphics.Path;
import org.futo.inputmethod.keyboard.PointerTracker;
import org.futo.inputmethod.latin.R;
import org.futo.inputmethod.latin.common.CoordinateUtils;
import org.futo.inputmethod.latin.uix.DynamicThemeProvider;
/**
* Draw rubber band preview graphics during sliding key input.
@ -44,9 +45,10 @@ public final class SlidingKeyInputDrawingPreview extends AbstractDrawingPreview
private final RoundedLine mRoundedLine = new RoundedLine();
private final Paint mPaint = new Paint();
public SlidingKeyInputDrawingPreview(final TypedArray mainKeyboardViewAttr) {
final int previewColor = mainKeyboardViewAttr.getColor(
R.styleable.MainKeyboardView_slidingKeyInputPreviewColor, 0);
public SlidingKeyInputDrawingPreview(final TypedArray mainKeyboardViewAttr, DynamicThemeProvider provider) {
final int previewColor = DynamicThemeProvider.Companion.getColorOrDefault(
R.styleable.MainKeyboardView_slidingKeyInputPreviewColor, 0,
mainKeyboardViewAttr, provider);
final float previewRadius = mainKeyboardViewAttr.getDimension(
R.styleable.MainKeyboardView_slidingKeyInputPreviewWidth, 0) / 2.0f;
final int PERCENTAGE_INT = 100;

View File

@ -217,6 +217,7 @@ class BasicThemeProvider(val context: Context, val overrideColorScheme: ColorSch
colors[R.styleable.Keyboard_Key_keyPreviewTextColor] = onSecondary
colors[R.styleable.MainKeyboardView_languageOnSpacebarTextColor] = onBackgroundHalf
colors[R.styleable.MainKeyboardView_gestureTrailColor] = primary
colors[R.styleable.MainKeyboardView_slidingKeyInputPreviewColor] = primary
val overrideDrawable: (Int, Int, Int) -> Unit = { a, b, color ->
drawables[a] = AppCompatResources.getDrawable(