public DocHolder(final MessagesAdapter fragment, View itemView) { super(fragment, itemView, false); // Basic bubble View bubbleView = itemView.findViewById(R.id.bubbleContainer); bubbleView.setBackgroundResource(R.drawable.conv_bubble_media_in); menu = itemView.findViewById(R.id.menu); menu.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { PopupMenu popup = new PopupMenu(fragment.getMessagesFragment().getActivity(), v); popup.getMenuInflater().inflate(R.menu.doc_popup, popup.getMenu()); popup.setOnMenuItemClickListener( new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { if (currentMessage != null && currentMessage.getContent() instanceof DocumentContent) { final DocumentContent documentContent = (DocumentContent) currentMessage.getContent(); if (documentContent.getSource() instanceof FileRemoteSource) { FileRemoteSource remoteSource = (FileRemoteSource) documentContent.getSource(); messenger() .requestState( remoteSource.getFileReference().getFileId(), new FileCallback() { @Override public void onNotDownloaded() {} @Override public void onDownloading(float progress) {} @Override public void onDownloaded(FileSystemReference reference) { Activity activity = getAdapter().getMessagesFragment().getActivity(); activity.startActivity( Intents.shareDoc( documentContent.getName(), reference.getDescriptor())); } }); } } return true; } }); popup.show(); } }); // Content views fileName = (TextView) itemView.findViewById(R.id.fileName); fileSize = (TextView) itemView.findViewById(R.id.fileSize); status = (TextView) itemView.findViewById(R.id.status); fileIcon = (ImageView) itemView.findViewById(R.id.icon); // Progress views downloadIcon = (TintImageView) itemView.findViewById(R.id.downloading); progressView = (CircularView) itemView.findViewById(R.id.progressView); progressView.setColor( fragment.getMessagesFragment().getActivity().getResources().getColor(R.color.primary)); progressValue = (TextView) itemView.findViewById(R.id.progressValue); }