mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-23 15:49:09 +00:00
workaround for toasts not showing up on some android versions
This commit is contained in:
parent
3758cfe403
commit
8916c67d15
2 changed files with 13 additions and 2 deletions
|
@ -341,7 +341,12 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
final SuggestedWordInfo info = mSuggestedWords.getInfo(i);
|
||||
if (info.getWord().equals(word)) {
|
||||
final String text = info.mSourceDict.mDictType + ":" + info.mSourceDict.mLocale;
|
||||
Toast.makeText(getContext(), text, Toast.LENGTH_LONG).show();
|
||||
// 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(DialogUtils.getPlatformDialogThemeContext(getContext()), wordView);
|
||||
uglyWorkaround.getMenu().add(Menu.NONE, 1, Menu.NONE, text);
|
||||
uglyWorkaround.show();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -136,7 +136,13 @@ class NewDictionaryAdder(private val context: Context, private val onAdded: ((Bo
|
|||
|
||||
private fun onDictionaryLoadingError(messageId: Int) {
|
||||
cachedDictionaryFile.delete()
|
||||
Toast.makeText(context, messageId, Toast.LENGTH_LONG).show()
|
||||
// Toast.makeText(context, messageId, Toast.LENGTH_LONG).show()
|
||||
// show a dialog because toasts are not showing up on some Android versions
|
||||
// possibly Android 13 because of notification permission
|
||||
AlertDialog.Builder(context)
|
||||
.setMessage(messageId)
|
||||
.setNegativeButton(R.string.dialog_close, null)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue