Remove unused SuggestionStripView

This commit is contained in:
Aleksandras Kostarevas 2024-08-25 09:10:52 +03:00
parent bc21ae55ee
commit 8bfaf44288
9 changed files with 1208 additions and 1711 deletions

View File

@ -25,8 +25,6 @@ import android.widget.FrameLayout;
import org.futo.inputmethod.accessibility.AccessibilityUtils;
import org.futo.inputmethod.keyboard.MainKeyboardView;
import org.futo.inputmethod.latin.suggestions.MoreSuggestionsView;
import org.futo.inputmethod.latin.suggestions.SuggestionStripView;
public final class InputView extends FrameLayout {
private final Rect mInputViewRect = new Rect();
@ -161,67 +159,6 @@ public final class InputView extends FrameLayout {
}
}
/**
* This class forwards {@link MotionEvent}s happened in the top padding of
* {@link MainKeyboardView} to {@link SuggestionStripView}.
*/
private static class KeyboardTopPaddingForwarder
extends MotionEventForwarder<MainKeyboardView, SuggestionStripView> {
private int mKeyboardTopPadding;
public KeyboardTopPaddingForwarder(final MainKeyboardView mainKeyboardView,
final SuggestionStripView suggestionStripView) {
super(mainKeyboardView, suggestionStripView);
}
public void setKeyboardTopPadding(final int keyboardTopPadding) {
mKeyboardTopPadding = keyboardTopPadding;
}
private boolean isInKeyboardTopPadding(final int y) {
return y < mEventSendingRect.top + mKeyboardTopPadding;
}
@Override
protected boolean needsToForward(final int x, final int y) {
// Forwarding an event only when {@link MainKeyboardView} is visible.
// Because the visibility of {@link MainKeyboardView} is controlled by its parent
// view in {@link KeyboardSwitcher#setMainKeyboardFrame()}, we should check the
// visibility of the parent view.
final View mainKeyboardFrame = (View)mSenderView.getParent();
return mainKeyboardFrame.getVisibility() == View.VISIBLE && isInKeyboardTopPadding(y);
}
@Override
protected int translateY(final int y) {
final int translatedY = super.translateY(y);
if (isInKeyboardTopPadding(y)) {
// The forwarded event should have coordinates that are inside of the target.
return Math.min(translatedY, mEventReceivingRect.height() - 1);
}
return translatedY;
}
}
/**
* This class forwards {@link MotionEvent}s happened in the {@link MainKeyboardView} to
* {@link SuggestionStripView} when the {@link MoreSuggestionsView} is showing.
* {@link SuggestionStripView} dismisses {@link MoreSuggestionsView} when it receives any event
* outside of it.
*/
private static class MoreSuggestionsViewCanceler
extends MotionEventForwarder<MainKeyboardView, SuggestionStripView> {
public MoreSuggestionsViewCanceler(final MainKeyboardView mainKeyboardView,
final SuggestionStripView suggestionStripView) {
super(mainKeyboardView, suggestionStripView);
}
@Override
protected boolean needsToForward(final int x, final int y) {
return false;
}
}
public void deallocateMemory() {
mMainKeyboardView.deallocateMemory();
}

View File

@ -82,10 +82,9 @@ import org.futo.inputmethod.latin.permissions.PermissionsManager;
import org.futo.inputmethod.latin.personalization.PersonalizationHelper;
import org.futo.inputmethod.latin.settings.Settings;
import org.futo.inputmethod.latin.settings.SettingsValues;
import org.futo.inputmethod.latin.suggestions.SuggestionStripView;
import org.futo.inputmethod.latin.suggestions.SuggestionStripViewAccessor;
import org.futo.inputmethod.latin.suggestions.SuggestionStripViewListener;
import org.futo.inputmethod.latin.touchinputconsumer.GestureConsumer;
import org.futo.inputmethod.latin.uix.actions.SwitchLanguageActionKt;
import org.futo.inputmethod.latin.uix.settings.SettingsActivity;
import org.futo.inputmethod.latin.utils.ApplicationUtils;
import org.futo.inputmethod.latin.utils.DialogUtils;
@ -112,7 +111,7 @@ import javax.annotation.Nullable;
* Input method implementation for Qwerty'ish keyboard.
*/
public class LatinIMELegacy implements KeyboardActionListener,
SuggestionStripView.Listener, SuggestionStripViewAccessor,
SuggestionStripViewListener, SuggestionStripViewAccessor,
DictionaryFacilitator.DictionaryInitializationListener,
PermissionsManager.PermissionsResultCallback {

View File

@ -1,271 +0,0 @@
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.futo.inputmethod.latin.suggestions;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import androidx.core.content.res.ResourcesCompat;
import org.futo.inputmethod.keyboard.Key;
import org.futo.inputmethod.keyboard.Keyboard;
import org.futo.inputmethod.keyboard.internal.KeyboardBuilder;
import org.futo.inputmethod.keyboard.internal.KeyboardIconsSet;
import org.futo.inputmethod.keyboard.internal.KeyboardParams;
import org.futo.inputmethod.latin.R;
import org.futo.inputmethod.latin.SuggestedWords;
import org.futo.inputmethod.latin.common.Constants;
import org.futo.inputmethod.latin.utils.TypefaceUtils;
public final class MoreSuggestions extends Keyboard {
public final SuggestedWords mSuggestedWords;
MoreSuggestions(final MoreSuggestionsParam params, final SuggestedWords suggestedWords) {
super(params);
mSuggestedWords = suggestedWords;
}
private static final class MoreSuggestionsParam extends KeyboardParams {
private final int[] mWidths = new int[SuggestedWords.MAX_SUGGESTIONS];
private final int[] mRowNumbers = new int[SuggestedWords.MAX_SUGGESTIONS];
private final int[] mColumnOrders = new int[SuggestedWords.MAX_SUGGESTIONS];
private final int[] mNumColumnsInRow = new int[SuggestedWords.MAX_SUGGESTIONS];
private static final int MAX_COLUMNS_IN_ROW = 3;
private int mNumRows;
public Drawable mDivider;
public int mDividerWidth;
public MoreSuggestionsParam() {
super();
}
public int layout(final SuggestedWords suggestedWords, final int fromIndex,
final int maxWidth, final int minWidth, final int maxRow, final Paint paint,
final Resources res) {
clearKeys();
mDivider = ResourcesCompat.getDrawable(res, R.drawable.more_suggestions_divider, null);
mDividerWidth = mDivider.getIntrinsicWidth();
final float padding = res.getDimension(
R.dimen.config_more_suggestions_key_horizontal_padding);
int row = 0;
int index = fromIndex;
int rowStartIndex = fromIndex;
final int size = Math.min(suggestedWords.size(), SuggestedWords.MAX_SUGGESTIONS);
while (index < size) {
final String word;
if (isIndexSubjectToAutoCorrection(suggestedWords, index)) {
// INDEX_OF_AUTO_CORRECTION and INDEX_OF_TYPED_WORD got swapped.
word = suggestedWords.getLabel(SuggestedWords.INDEX_OF_TYPED_WORD);
} else {
word = suggestedWords.getLabel(index);
}
// TODO: Should take care of text x-scaling.
mWidths[index] = (int)(TypefaceUtils.getStringWidth(word, paint) + padding);
final int numColumn = index - rowStartIndex + 1;
final int columnWidth =
(maxWidth - mDividerWidth * (numColumn - 1)) / numColumn;
if (numColumn > MAX_COLUMNS_IN_ROW
|| !fitInWidth(rowStartIndex, index + 1, columnWidth)) {
if ((row + 1) >= maxRow) {
break;
}
mNumColumnsInRow[row] = index - rowStartIndex;
rowStartIndex = index;
row++;
}
mColumnOrders[index] = index - rowStartIndex;
mRowNumbers[index] = row;
index++;
}
mNumColumnsInRow[row] = index - rowStartIndex;
mNumRows = row + 1;
mBaseWidth = mOccupiedWidth = Math.max(
minWidth, calcurateMaxRowWidth(fromIndex, index));
mBaseHeight = mOccupiedHeight = mNumRows * mDefaultRowHeight + mVerticalGap;
return index - fromIndex;
}
private boolean fitInWidth(final int startIndex, final int endIndex, final int width) {
for (int index = startIndex; index < endIndex; index++) {
if (mWidths[index] > width)
return false;
}
return true;
}
private int calcurateMaxRowWidth(final int startIndex, final int endIndex) {
int maxRowWidth = 0;
int index = startIndex;
for (int row = 0; row < mNumRows; row++) {
final int numColumnInRow = mNumColumnsInRow[row];
int maxKeyWidth = 0;
while (index < endIndex && mRowNumbers[index] == row) {
maxKeyWidth = Math.max(maxKeyWidth, mWidths[index]);
index++;
}
maxRowWidth = Math.max(maxRowWidth,
maxKeyWidth * numColumnInRow + mDividerWidth * (numColumnInRow - 1));
}
return maxRowWidth;
}
private static final int[][] COLUMN_ORDER_TO_NUMBER = {
{ 0 }, // center
{ 1, 0 }, // right-left
{ 1, 0, 2 }, // center-left-right
};
public int getNumColumnInRow(final int index) {
return mNumColumnsInRow[mRowNumbers[index]];
}
public int getColumnNumber(final int index) {
final int columnOrder = mColumnOrders[index];
final int numColumn = getNumColumnInRow(index);
return COLUMN_ORDER_TO_NUMBER[numColumn - 1][columnOrder];
}
public int getX(final int index) {
final int columnNumber = getColumnNumber(index);
return columnNumber * (getWidth(index) + mDividerWidth);
}
public int getY(final int index) {
final int row = mRowNumbers[index];
return (mNumRows -1 - row) * mDefaultRowHeight + mTopPadding;
}
public int getWidth(final int index) {
final int numColumnInRow = getNumColumnInRow(index);
return (mOccupiedWidth - mDividerWidth * (numColumnInRow - 1)) / numColumnInRow;
}
public void markAsEdgeKey(final Key key, final int index) {
final int row = mRowNumbers[index];
if (row == 0)
key.markAsBottomEdge(this);
if (row == mNumRows - 1)
key.markAsTopEdge(this);
final int numColumnInRow = mNumColumnsInRow[row];
final int column = getColumnNumber(index);
if (column == 0)
key.markAsLeftEdge(this);
if (column == numColumnInRow - 1)
key.markAsRightEdge(this);
}
}
static boolean isIndexSubjectToAutoCorrection(final SuggestedWords suggestedWords,
final int index) {
return suggestedWords.mWillAutoCorrect && index == SuggestedWords.INDEX_OF_AUTO_CORRECTION;
}
public static final class Builder extends KeyboardBuilder<MoreSuggestionsParam> {
private final MoreSuggestionsView mPaneView;
private SuggestedWords mSuggestedWords;
private int mFromIndex;
private int mToIndex;
public Builder(final Context context, final MoreSuggestionsView paneView) {
super(context, new MoreSuggestionsParam());
mPaneView = paneView;
}
public Builder layout(final SuggestedWords suggestedWords, final int fromIndex,
final int maxWidth, final int minWidth, final int maxRow,
final Keyboard parentKeyboard) {
final int xmlId = R.xml.kbd_suggestions_pane_template;
load(xmlId, parentKeyboard.mId);
mParams.mVerticalGap = mParams.mTopPadding = parentKeyboard.mVerticalGap / 2;
mPaneView.updateKeyboardGeometry(mParams.mDefaultRowHeight);
final int count = mParams.layout(suggestedWords, fromIndex, maxWidth, minWidth, maxRow,
mPaneView.newLabelPaint(null /* key */), mResources);
mFromIndex = fromIndex;
mToIndex = fromIndex + count;
mSuggestedWords = suggestedWords;
return this;
}
@Override
public MoreSuggestions build() {
final MoreSuggestionsParam params = mParams;
for (int index = mFromIndex; index < mToIndex; index++) {
final int x = params.getX(index);
final int y = params.getY(index);
final int width = params.getWidth(index);
final String word;
final String info;
if (isIndexSubjectToAutoCorrection(mSuggestedWords, index)) {
// INDEX_OF_AUTO_CORRECTION and INDEX_OF_TYPED_WORD got swapped.
word = mSuggestedWords.getLabel(SuggestedWords.INDEX_OF_TYPED_WORD);
info = mSuggestedWords.getDebugString(SuggestedWords.INDEX_OF_TYPED_WORD);
} else {
word = mSuggestedWords.getLabel(index);
info = mSuggestedWords.getDebugString(index);
}
final Key key = new MoreSuggestionKey(word, info, index, params);
params.markAsEdgeKey(key, index);
params.onAddKey(key);
final int columnNumber = params.getColumnNumber(index);
final int numColumnInRow = params.getNumColumnInRow(index);
if (columnNumber < numColumnInRow - 1) {
final Divider divider = new Divider(params, params.mDivider, x + width, y,
params.mDividerWidth, params.mDefaultRowHeight);
params.onAddKey(divider);
}
}
return new MoreSuggestions(params, mSuggestedWords);
}
}
static final class MoreSuggestionKey extends Key {
public final int mSuggestedWordIndex;
public MoreSuggestionKey(final String word, final String info, final int index,
final MoreSuggestionsParam params) {
super(word /* label */, KeyboardIconsSet.ICON_UNDEFINED, Constants.CODE_OUTPUT_TEXT,
word /* outputText */, info, 0 /* labelFlags */, Key.BACKGROUND_TYPE_NORMAL,
params.getX(index), params.getY(index), params.getWidth(index),
params.mDefaultRowHeight, params.mHorizontalGap, params.mVerticalGap,
Key.ACTION_FLAGS_NO_KEY_PREVIEW);
mSuggestedWordIndex = index;
}
}
private static final class Divider extends Key.Spacer {
private final Drawable mIcon;
public Divider(final KeyboardParams params, final Drawable icon, final int x,
final int y, final int width, final int height) {
super(params, x, y, width, height);
mIcon = icon;
}
@Override
public Drawable getIcon(final KeyboardIconsSet iconSet, final int alpha) {
// KeyboardIconsSet and alpha are unused. Use the icon that has been passed to the
// constructor.
// TODO: Drawable itself should have an alpha value.
mIcon.setAlpha(128);
return mIcon;
}
}
}

View File

@ -1,117 +0,0 @@
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.futo.inputmethod.latin.suggestions;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import org.futo.inputmethod.keyboard.Key;
import org.futo.inputmethod.keyboard.Keyboard;
import org.futo.inputmethod.keyboard.KeyboardActionListener;
import org.futo.inputmethod.keyboard.MoreKeysKeyboardView;
import org.futo.inputmethod.latin.R;
import org.futo.inputmethod.latin.SuggestedWords;
import org.futo.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import org.futo.inputmethod.latin.suggestions.MoreSuggestions.MoreSuggestionKey;
/**
* A view that renders a virtual {@link MoreSuggestions}. It handles rendering of keys and detecting
* key presses and touch movements.
*/
public final class MoreSuggestionsView extends MoreKeysKeyboardView {
private static final String TAG = MoreSuggestionsView.class.getSimpleName();
public static abstract class MoreSuggestionsListener extends KeyboardActionListener.Adapter {
public abstract void onSuggestionSelected(final SuggestedWordInfo info);
}
private boolean mIsInModalMode;
public MoreSuggestionsView(final Context context, final AttributeSet attrs) {
this(context, attrs, R.attr.moreKeysKeyboardViewStyle);
}
public MoreSuggestionsView(final Context context, final AttributeSet attrs,
final int defStyle) {
super(context, attrs, defStyle);
}
// TODO: Remove redundant override method.
@Override
public void setKeyboard(final Keyboard keyboard) {
super.setKeyboard(keyboard);
mIsInModalMode = false;
// With accessibility mode off, {@link #mAccessibilityDelegate} is set to null at the
// above {@link MoreKeysKeyboardView#setKeyboard(Keyboard)} call.
// With accessibility mode on, {@link #mAccessibilityDelegate} is set to a
// {@link MoreKeysKeyboardAccessibilityDelegate} object at the above
// {@link MoreKeysKeyboardView#setKeyboard(Keyboard)} call.
if (mAccessibilityDelegate != null) {
mAccessibilityDelegate.setOpenAnnounce(R.string.spoken_open_more_suggestions);
mAccessibilityDelegate.setCloseAnnounce(R.string.spoken_close_more_suggestions);
}
}
@Override
protected int getDefaultCoordX() {
final MoreSuggestions pane = (MoreSuggestions)getKeyboard();
return pane.mOccupiedWidth / 2;
}
public void updateKeyboardGeometry(final int keyHeight) {
updateKeyDrawParams(keyHeight);
}
public void setModalMode() {
mIsInModalMode = true;
// Set vertical correction to zero (Reset more keys keyboard sliding allowance
// {@link R#dimen.config_more_keys_keyboard_slide_allowance}).
mKeyDetector.setKeyboard(getKeyboard(), -getPaddingLeft(), -getPaddingTop());
}
public boolean isInModalMode() {
return mIsInModalMode;
}
@Override
protected void onKeyInput(final Key key, final int x, final int y) {
if (!(key instanceof MoreSuggestionKey)) {
Log.e(TAG, "Expected key is MoreSuggestionKey, but found "
+ key.getClass().getName());
return;
}
final Keyboard keyboard = getKeyboard();
if (!(keyboard instanceof MoreSuggestions)) {
Log.e(TAG, "Expected keyboard is MoreSuggestions, but found "
+ keyboard.getClass().getName());
return;
}
final SuggestedWords suggestedWords = ((MoreSuggestions)keyboard).mSuggestedWords;
final int index = ((MoreSuggestionKey)key).mSuggestedWordIndex;
if (index < 0 || index >= suggestedWords.size()) {
Log.e(TAG, "Selected suggestion has an illegal index: " + index);
return;
}
if (!(mListener instanceof MoreSuggestionsListener)) {
Log.e(TAG, "Expected mListener is MoreSuggestionsListener, but found "
+ mListener.getClass().getName());
return;
}
((MoreSuggestionsListener)mListener).onSuggestionSelected(suggestedWords.getInfo(index));
}
}

View File

@ -13,81 +13,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.futo.inputmethod.latin.suggestions
package org.futo.inputmethod.latin.suggestions;
import org.futo.inputmethod.latin.SuggestedWords
import org.futo.inputmethod.latin.SuggestedWords.SuggestedWordInfo
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import androidx.core.view.ViewCompat;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.GestureDetector;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.TextView;
import org.futo.inputmethod.accessibility.AccessibilityUtils;
import org.futo.inputmethod.keyboard.Keyboard;
import org.futo.inputmethod.keyboard.MainKeyboardView;
import org.futo.inputmethod.keyboard.MoreKeysPanel;
import org.futo.inputmethod.latin.AudioAndHapticFeedbackManager;
import org.futo.inputmethod.latin.R;
import org.futo.inputmethod.latin.SuggestedWords;
import org.futo.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import org.futo.inputmethod.latin.common.Constants;
import org.futo.inputmethod.latin.define.DebugFlags;
import org.futo.inputmethod.latin.settings.Settings;
import org.futo.inputmethod.latin.settings.SettingsValues;
import org.futo.inputmethod.latin.suggestions.MoreSuggestionsView.MoreSuggestionsListener;
import org.futo.inputmethod.latin.utils.ImportantNoticeUtils;
import java.util.ArrayList;
public final class SuggestionStripView extends RelativeLayout implements OnClickListener,
OnLongClickListener {
@Override
public void onClick(View v) {
}
@Override
public boolean onLongClick(View v) {
return false;
}
public interface Listener {
public void showImportantNoticeContents();
public void pickSuggestionManually(SuggestedWordInfo word);
public void requestForgetWord(SuggestedWordInfo word);
public void onCodeInput(int primaryCode, int x, int y, boolean isKeyRepeat);
}
static final boolean DBG = DebugFlags.DEBUG_ENABLED;
/**
* Construct a {@link SuggestionStripView} for showing suggestions to be picked by the user.
* @param context
* @param attrs
*/
public SuggestionStripView(final Context context, final AttributeSet attrs) {
this(context, attrs, R.attr.suggestionStripViewStyle);
}
public SuggestionStripView(final Context context, final AttributeSet attrs,
final int defStyle) {
super(context, attrs, defStyle);
}
interface SuggestionStripViewListener {
fun showImportantNoticeContents()
fun pickSuggestionManually(word: SuggestedWordInfo?)
fun requestForgetWord(word: SuggestedWordInfo?)
fun onCodeInput(primaryCode: Int, x: Int, y: Int, isKeyRepeat: Boolean)
}
/**
* An object that gives basic control of a suggestion strip and some info on it.
*/
interface SuggestionStripViewAccessor {
fun setNeutralSuggestionStrip()
fun showSuggestionStrip(suggestedWords: SuggestedWords?)
}

View File

@ -1,27 +0,0 @@
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.futo.inputmethod.latin.suggestions;
import org.futo.inputmethod.latin.SuggestedWords;
/**
* An object that gives basic control of a suggestion strip and some info on it.
*/
public interface SuggestionStripViewAccessor {
public void setNeutralSuggestionStrip();
public void showSuggestionStrip(final SuggestedWords suggestedWords);
}

View File

@ -37,7 +37,6 @@ import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.TextButton
import androidx.compose.material3.contentColorFor
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.runtime.Composable
@ -89,7 +88,7 @@ import org.futo.inputmethod.latin.SuggestedWords.SuggestedWordInfo
import org.futo.inputmethod.latin.SuggestedWords.SuggestedWordInfo.KIND_EMOJI_SUGGESTION
import org.futo.inputmethod.latin.SuggestedWords.SuggestedWordInfo.KIND_TYPED
import org.futo.inputmethod.latin.common.Constants
import org.futo.inputmethod.latin.suggestions.SuggestionStripView
import org.futo.inputmethod.latin.suggestions.SuggestionStripViewListener
import org.futo.inputmethod.latin.uix.actions.FavoriteActions
import org.futo.inputmethod.latin.uix.actions.MoreActionsAction
import org.futo.inputmethod.latin.uix.actions.PinnedActions
@ -646,7 +645,7 @@ fun ActionSep() {
@Composable
fun ActionBar(
words: SuggestedWords?,
suggestionStripListener: SuggestionStripView.Listener,
suggestionStripListener: SuggestionStripViewListener,
onActionActivated: (Action) -> Unit,
onActionAltActivated: (Action) -> Unit,
inlineSuggestions: List<MutableState<View?>>,
@ -786,7 +785,7 @@ fun CollapsibleSuggestionsBar(
onClose: () -> Unit,
onCollapse: () -> Unit,
words: SuggestedWords?,
suggestionStripListener: SuggestionStripView.Listener,
suggestionStripListener: SuggestionStripViewListener,
) {
Column {
ActionSep()
@ -851,7 +850,7 @@ fun CollapsibleSuggestionsBar(
/* ---- Previews ---- */
class ExampleListener : SuggestionStripView.Listener {
class ExampleListener : SuggestionStripViewListener {
override fun showImportantNoticeContents() {
}

View File

@ -74,7 +74,7 @@ import org.futo.inputmethod.latin.SuggestedWords
import org.futo.inputmethod.latin.SuggestedWords.SuggestedWordInfo
import org.futo.inputmethod.latin.common.Constants
import org.futo.inputmethod.latin.inputlogic.InputLogic
import org.futo.inputmethod.latin.suggestions.SuggestionStripView
import org.futo.inputmethod.latin.suggestions.SuggestionStripViewListener
import org.futo.inputmethod.latin.uix.actions.ActionEditor
import org.futo.inputmethod.latin.uix.actions.ActionRegistry
import org.futo.inputmethod.latin.uix.actions.AllActions
@ -372,7 +372,7 @@ class UixManager(private val latinIME: LatinIME) {
if(actionBarShown.value) {
ActionBar(
suggestedWordsOrNull,
latinIME.latinIMELegacy as SuggestionStripView.Listener,
latinIME.latinIMELegacy as SuggestionStripViewListener,
inlineSuggestions = inlineSuggestions,
onActionActivated = {
keyboardManagerForAction.performHapticAndAudioFeedback(
@ -490,7 +490,7 @@ class UixManager(private val latinIME: LatinIME) {
onCollapse = { toggleExpandAction() },
onClose = { returnBackToMainKeyboardViewFromAction() },
words = suggestedWordsOrNull,
suggestionStripListener = latinIME.latinIMELegacy as SuggestionStripView.Listener
suggestionStripListener = latinIME.latinIMELegacy as SuggestionStripViewListener
)
}
}