From 853d970642013f66128b2d9b87bd1f84382e6e4b Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 10 Mar 2020 10:58:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/ui/book/read/TextActionMenu.kt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt index 7e90c7ad1..9d7046f6e 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt @@ -151,15 +151,16 @@ class TextActionMenu(private val context: Context, private val callBack: CallBac */ @RequiresApi(Build.VERSION_CODES.M) private fun onInitializeMenu(menu: Menu) { - // Start with a menu Item order value that is high enough - // so that your "PROCESS_TEXT" menu items appear after the - // standard selection menu items like Cut, Copy, Paste. - var menuItemOrder = 100 - for (resolveInfo in getSupportedActivities()) { - menu.add( - Menu.NONE, Menu.NONE, - menuItemOrder++, resolveInfo.loadLabel(context.packageManager) - ).intent = createProcessTextIntentForResolveInfo(resolveInfo) + try { + var menuItemOrder = 100 + for (resolveInfo in getSupportedActivities()) { + menu.add( + Menu.NONE, Menu.NONE, + menuItemOrder++, resolveInfo.loadLabel(context.packageManager) + ).intent = createProcessTextIntentForResolveInfo(resolveInfo) + } + } catch (e: Exception) { + context.toast("获取文字操作菜单出错:${e.localizedMessage}") } }