use of in.bugzy.ui.caseevents.CaseEventsAdapter in project bugzy by cpunq.
the class CaseEditActivity method setupEventsRecyclerView.
private void setupEventsRecyclerView() {
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
mEventsRecyclerView.setLayoutManager(layoutManager);
mAdapter = new CaseEventsAdapter(this);
mAdapter.setOnAttachmentClickListener(new CaseEventsAdapter.OnAttachmentClickListener() {
@Override
public void onAttachmentClick(View v, CaseEvent event, int attachmentPosition) {
Attachment attachment = event.getsAttachments().get(attachmentPosition);
String filename = attachment.getFilename().toLowerCase();
if (filename.endsWith("png") || filename.endsWith("jpg") || filename.endsWith("jpeg")) {
openImageActivity(v, attachment.getFullUrl());
return;
}
// For other attachments leave things to browser
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(attachment.getFullUrl()));
startActivity(i);
}
});
mEventsRecyclerView.setAdapter(mAdapter);
mEventsRecyclerView.setNestedScrollingEnabled(false);
}
use of in.bugzy.ui.caseevents.CaseEventsAdapter in project bugzy by cpunq.
the class CaseDetailsFragment method setupViews.
private void setupViews() {
mlinearLayoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(mlinearLayoutManager);
mAdapter = new CaseEventsAdapter(getContext());
mRecyclerView.setAdapter(mAdapter);
mAdapter.setOnAttachmentClickListener((view, event, attachmentPosition) -> {
// TODO: Move this logic to ViewModel
Attachment attachment = event.getsAttachments().get(attachmentPosition);
String filename = attachment.getFilename().toLowerCase();
if (filename.endsWith("png") || filename.endsWith("jpg") || filename.endsWith("jpeg")) {
mParentActivity.openImageActivity(view, attachment.getFullUrl());
return;
}
// For other attachments leave things to browser
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(attachment.getFullUrl()));
startActivity(i);
});
prepareActionsButtons();
prepareRecyclerScrollListener();
}
Aggregations