Search in sources :

Example 1 with CaseEventsAdapter

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);
}
Also used : CaseEventsAdapter(in.bugzy.ui.caseevents.CaseEventsAdapter) Attachment(in.bugzy.data.model.Attachment) Intent(android.content.Intent) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) BindView(butterknife.BindView) NachoTextView(com.hootsuite.nachos.NachoTextView) View(android.view.View) AdapterView(android.widget.AdapterView) ImagePickerSheetView(com.flipboard.bottomsheet.commons.ImagePickerSheetView) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) CaseEvent(in.bugzy.data.model.CaseEvent)

Example 2 with CaseEventsAdapter

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();
}
Also used : CaseEventsAdapter(in.bugzy.ui.caseevents.CaseEventsAdapter) Attachment(in.bugzy.data.model.Attachment) Intent(android.content.Intent) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Aggregations

Intent (android.content.Intent)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 Attachment (in.bugzy.data.model.Attachment)2 CaseEventsAdapter (in.bugzy.ui.caseevents.CaseEventsAdapter)2 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 ImagePickerSheetView (com.flipboard.bottomsheet.commons.ImagePickerSheetView)1 NachoTextView (com.hootsuite.nachos.NachoTextView)1 CaseEvent (in.bugzy.data.model.CaseEvent)1