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

@ -10,11 +10,14 @@ import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.inputmethodservice.InputMethodService;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.CharacterStyle;
import helium314.keyboard.keyboard.KeyboardSwitcher;
import helium314.keyboard.latin.utils.Log;
import android.view.KeyEvent;
import android.view.inputmethod.CompletionInfo;
@ -671,6 +674,9 @@ public final class RichInputConnection implements PrivateCommandPerformer {
if (text == null || text.length() == 0) return;
final ClipboardManager cm = (ClipboardManager) mParent.getSystemService(Context.CLIPBOARD_SERVICE);
cm.setPrimaryClip(ClipData.newPlainText("copied text", text));
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) {
KeyboardSwitcher.getInstance().showToast(mParent.getString(R.string.toast_msg_clipboard_copy), true);
}
}
public void commitCorrection(final CorrectionInfo correctionInfo) {