(ActionMode mode, MenuItem item)
| 2792 | } |
| 2793 | |
| 2794 | @Override |
| 2795 | public boolean onActionItemClicked(ActionMode mode, MenuItem item) { |
| 2796 | if (item.getGroupId() == Menu.CATEGORY_SECONDARY) |
| 2797 | try { |
| 2798 | int id = item.getItemId(); |
| 2799 | if (id == R.string.title_insert_contact) { |
| 2800 | String email = getSelected(); |
| 2801 | String name = UriHelper.getEmailUser(email); |
| 2802 | |
| 2803 | Intent insert = new Intent(); |
| 2804 | insert.putExtra(ContactsContract.Intents.Insert.EMAIL, email); |
| 2805 | if (!TextUtils.isEmpty(name)) |
| 2806 | insert.putExtra(ContactsContract.Intents.Insert.NAME, name); |
| 2807 | insert.setAction(Intent.ACTION_INSERT); |
| 2808 | insert.setType(ContactsContract.Contacts.CONTENT_TYPE); |
| 2809 | view.getContext().startActivity(insert); |
| 2810 | } else if (id == R.string.title_select_block) { |
| 2811 | Pair<Integer, Integer> block = StyleHelper.getParagraph(view, true); |
| 2812 | if (block != null) |
| 2813 | android.text.Selection.setSelection((Spannable) view.getText(), block.first, block.second); |
| 2814 | return true; |
| 2815 | } |
| 2816 | } catch (Throwable ex) { |
| 2817 | Log.e(ex); |
| 2818 | } |
| 2819 | return false; |
| 2820 | } |
| 2821 | |
| 2822 | @Override |
| 2823 | public void onDestroyActionMode(ActionMode mode) { |
nothing calls this directly
no test coverage detected