\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0438, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 Android, \u043d\u0430 \u0447\u044c\u0438\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u00a0\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Google Translate<\/a>\u00a0\u043f\u043e\u043b\u0443\u0447\u0430\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u00a0\u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u043d\u0430\u00a090 \u044f\u0437\u044b\u043a\u043e\u0432 \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0437 \u0438\u0445 \u043b\u044e\u0431\u0438\u043c\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u043f\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b Android\u00a0(Android 6.0, Marshmallow).<\/p>\n \u0421\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PackageManager \u0432\u0441\u0435\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043c\u0435\u044e\u0442 \u0444\u0438\u043b\u044c\u0442\u0440 \u0438\u043d\u0442\u0435\u043d\u0442\u043e\u0432 PROCESS_TEXT (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: com.google.android.apps.translate — \u0435\u0441\u043b\u0438 \u043e\u043d \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d) \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u0445 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 MenuItems \u0432 TextView \u0432\u044b\u0431\u043e\u0440\u0430 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/p>\n \u041c\u0435\u0442\u043a\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0441:<\/p>\n Intent \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0438\u043d\u0442\u0435\u043d\u0442\u043e\u0432, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u043d\u0435\u0435 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0438\u0445\u00a0\u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0432 \u043c\u0435\u043d\u044e \u0432\u044b\u0431\u043e\u0440\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u0432\u00a0Android \u00a0\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e ) \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430. \u0418 \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430, \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430, \u043f\u043e\u043a\u0430\u00a0\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Google Translate \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n \u0421 \u044d\u0442\u043e\u0439 \u043d\u043e\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 Android Translate app \u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0441\u043c\u043e\u0433\u0443\u0442 \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c\u00a0\u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u00a0\u0441\u0432\u043e\u0438\u0445\u00a0\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 Android \u043e\u0431\u0435\u0449\u0430\u044e\u0442\u00a0\u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043a\u043e\u0434\u0430 \u043d\u0430 \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0435\u00a0\u043d\u0435\u0434\u0435\u043b\u0438.<\/p>\n Google Translate \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0431\u043e\u043b\u0435\u0435 500 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u0435\u0441\u044f\u0446, \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u044f \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c\u00a0100 \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434\u043e\u0432 \u0441\u043b\u043e\u0432\u00a0\u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c. \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0438, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 Android, \u043d\u0430 \u0447\u044c\u0438\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u00a0\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Google Translate\u00a0\u043f\u043e\u043b\u0443\u0447\u0430\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u00a0\u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u043d\u0430\u00a090 \u044f\u0437\u044b\u043a\u043e\u0432 \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0437 \u0438\u0445 \u043b\u044e\u0431\u0438\u043c\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u043f\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b Android\u00a0(Android 6.0, Marshmallow). TripAdvisor, \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0441 \u043f\u043e\u0440\u0442\u0443\u0433\u0430\u043b\u044c\u0441\u043a\u043e\u0433\u043e\u00a0 \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 […]<\/p>\n","protected":false},"author":1,"featured_media":3293,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[39,7],"tags":[3,63,56,59,65,58,136,26,140,4,309,133],"_links":{"self":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/posts\/3292"}],"collection":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/comments?post=3292"}],"version-history":[{"count":0,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/posts\/3292\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/media\/3293"}],"wp:attachment":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/media?parent=3292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/categories?post=3292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/tags?post=3292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\n
private<\/span> Intent<\/span> createProcessTextIntent<\/span>()<\/span> {<\/span>\r\n\u00a0 \u00a0 <\/span>return<\/span> new<\/span> Intent<\/span>()<\/span>\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span>.<\/span>setAction<\/span>(<\/span>Intent<\/span>.<\/span>ACTION_PROCESS_TEXT<\/span>)<\/span>\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span>.<\/span>setType<\/span>(<\/span>\"text\/plain\"<\/span>);<\/span>\r\n}<\/span><\/pre>\n<\/li>\n
private<\/span> List<\/span> getSupportedActivities<\/span>()<\/span> {<\/span>\r\n\u00a0 \u00a0 <\/span>PackageManager<\/span> packageManager <\/span>=<\/span>\r\nmTextView<\/span>.<\/span>getContext<\/span>().<\/span>getPackageManager<\/span>();<\/span>\r\n\u00a0 \u00a0 <\/span>return<\/span>\r\npackageManager<\/span>.<\/span>queryIntentActivities<\/span>(<\/span>createProcessTextIntent<\/span>(),<\/span>\r\n0<\/span>);<\/span>\r\n}<\/span><\/pre>\n<\/li>\n
public<\/span> void<\/span> onInitializeMenu<\/span>(<\/span>Menu<\/span> menu<\/span>)<\/span> {<\/span>\r\n\u00a0 \u00a0 <\/span>\/\/ Start with a menu Item order value that is high enough<\/span>\r\n\u00a0 \u00a0 <\/span>\/\/ so that your \"PROCESS_TEXT\" menu items appear after the<\/span>\r\n\u00a0 \u00a0 <\/span>\/\/ standard selection menu items like Cut, Copy, Paste.<\/span>\r\n\u00a0 \u00a0 <\/span>int<\/span> menuItemOrder <\/span>=<\/span> 100<\/span>;<\/span>\r\n\u00a0 \u00a0 <\/span>for<\/span> (<\/span>ResolveInfo<\/span> resolveInfo <\/span>:<\/span> getSupportedActivities<\/span>())<\/span> {<\/span>\r\n\u00a0 \u00a0 \u00a0 \u00a0 menu<\/span>.<\/span>add<\/span>(<\/span>Menu<\/span>.<\/span>NONE<\/span>,<\/span> Menu<\/span>.<\/span>NONE<\/span>,<\/span>\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 menuItemOrder<\/span>++,<\/span>\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 getLabel<\/span>(<\/span>resolveInfo<\/span>))<\/span>\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \r\n<\/span>.<\/span>setIntent<\/span>(<\/span>createProcessTextIntentForResolveInfo<\/span>(<\/span>resolveInfo<\/span>))<\/span>\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span>.<\/span>setShowAsAction<\/span>(<\/span>MenuItem<\/span>.<\/span>SHOW_AS_ACTION_IF_ROOM<\/span>);<\/span>\r\n\u00a0 \u00a0 <\/span>}<\/span>\r\n}<\/span><\/pre>\n<\/li>\n<\/ol>\n
resolveInfo<\/span>.<\/span>loadLabel<\/span>(<\/span>mPackageManager<\/span>);<\/span><\/pre>\n
private<\/span> Intent<\/span> createProcessTextIntentForResolveInfo<\/span>(<\/span>ResolveInfo<\/span> info<\/span>)<\/span> {<\/span>\r\n\u00a0 \u00a0 <\/span>return<\/span> createProcessTextIntent<\/span>()<\/span>\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span>.<\/span>putExtra<\/span>(<\/span>Intent<\/span>.<\/span>EXTRA_PROCESS_TEXT_READONLY<\/span>,<\/span> !<\/span>\r\nmTextView<\/span>.<\/span>isTextEditable<\/span>())<\/span>\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span>.<\/span>setClassName<\/span>(<\/span>info<\/span>.<\/span>activityInfo<\/span>.<\/span>packageName<\/span>,<\/span> \r\ninfo<\/span>.<\/span>activityInfo<\/span>.<\/span>name<\/span>);<\/span>\r\n}<\/span><\/pre>\n
\u00a0\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a:\u00a0\u00a0Barak Turovsky, Product Lead, Google Translate<\/a><\/h6>\n<\/div>\n","protected":false},"excerpt":{"rendered":"