Add toast notification when copying from clipboard (#752)

and use the toast for showing dictionary on double-long-press word: switch from one ugly workaround (popup menu) to another (hiding more suggestions panel)

Co-authored-by: codokie <@>
Co-authored-by: Helium314 <helium314@mailbox.org>
This commit is contained in:
codokie 2024-05-31 18:01:50 +03:00 committed by GitHub
parent df6af1f07e
commit e357f84572
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 101 additions and 7 deletions

View file

@ -41,6 +41,7 @@ import android.widget.TextView;
import helium314.keyboard.accessibility.AccessibilityUtils;
import helium314.keyboard.keyboard.Keyboard;
import helium314.keyboard.keyboard.KeyboardSwitcher;
import helium314.keyboard.keyboard.MainKeyboardView;
import helium314.keyboard.keyboard.PopupKeysPanel;
import helium314.keyboard.keyboard.internal.keyboard_parser.floris.KeyCode;
@ -445,12 +446,10 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
final SuggestedWordInfo info = mSuggestedWords.getInfo(index);
if (!info.getWord().equals(word)) return;
final String text = info.mSourceDict.mDictType + ":" + info.mSourceDict.mLocale;
// apparently toast is not working on some Android versions, probably
// Android 13 with the notification permission
// Toast.makeText(getContext(), text, Toast.LENGTH_LONG).show();
final PopupMenu uglyWorkaround = new PopupMenu(DialogUtilsKt.getPlatformDialogThemeContext(getContext()), wordView);
uglyWorkaround.getMenu().add(Menu.NONE, 1, Menu.NONE, text);
uglyWorkaround.show();
if (isShowingMoreSuggestionPanel()) {
mMoreSuggestionsView.dismissPopupKeysPanel();
}
KeyboardSwitcher.getInstance().showToast(text, true);
}
private void removeSuggestion(TextView wordView) {