/** * Returns the direction of the transfer * * @return Direction * @see Direction * @throws RcsPersistentStorageException * @throws RcsGenericException */ public Direction getDirection() throws RcsPersistentStorageException, RcsGenericException { try { return Direction.valueOf(mTransferInf.getDirection()); } catch (Exception e) { RcsPersistentStorageException.assertException(e); throw new RcsGenericException(e); } }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); /* Get the list item position. */ AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; Cursor cursor = (Cursor) mAdapter.getItem(info.position); menu.add(0, GROUPCHAT_MENU_ITEM_DELETE, 0, R.string.menu_delete_message); Direction direction = Direction.valueOf(cursor.getInt(cursor.getColumnIndexOrThrow(Message.DIRECTION))); if (Direction.OUTGOING == direction) { menu.add(0, GROUPCHAT_MENU_ITEM_VIEW_GC_INFO, 1, R.string.menu_view_groupdelivery); // TODO depending on mime-type and provider ID, allow user to view file image } }
private void cacheData() { Cursor cursor = null; try { cursor = mMessagingLog.getGroupChatData(mChatId); if (!cursor.moveToNext()) { throw new ServerApiPersistentStorageException( new StringBuilder("Data not found for group chat ").append(mChatId).toString()); } mSubject = cursor.getString(cursor.getColumnIndexOrThrow(GroupChatData.KEY_SUBJECT)); mDirection = Direction.valueOf( cursor.getInt(cursor.getColumnIndexOrThrow(GroupChatData.KEY_DIRECTION))); String contact = cursor.getString(cursor.getColumnIndexOrThrow(GroupChatData.KEY_CONTACT)); if (contact != null) { mContact = ContactUtil.createContactIdFromTrustedData(contact); } mTimestamp = cursor.getLong(cursor.getColumnIndexOrThrow(GroupChatData.KEY_TIMESTAMP)); } finally { if (cursor != null) { cursor.close(); } } }