use of in.bugzy.data.model.CaseEvent 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.data.model.CaseEvent in project bugzy by cpunq.
the class CaseEventsAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(EventHolder holder, int position) {
CaseEvent bug = mCaseEvents.get(position);
holder.bindData(bug, mLayoutManagerSavedStates.get(bug.getBugEvent()));
}
use of in.bugzy.data.model.CaseEvent in project bugzy by cpunq.
the class CaseEventsAdapter method saveInstanceState.
public void saveInstanceState(EventHolder holder) {
if (holder.getAdapterPosition() == RecyclerView.NO_POSITION) {
return;
}
CaseEvent event = mCaseEvents.get(holder.getAdapterPosition());
Parcelable p = holder.onSaveLayoutManagerState();
if (p != null) {
mLayoutManagerSavedStates.put(event.getBugEvent(), p);
}
}
use of in.bugzy.data.model.CaseEvent in project bugzy by cpunq.
the class CaseDetailsFragment method showCaseDetails.
@UiThread
protected void showCaseDetails(Case aCase) {
mCase = aCase;
showContent();
showActionButtons(mCase);
List<CaseEvent> evs = mCase.getCaseevents();
if (evs != null) {
mAdapter.setData(evs);
mAdapter.notifyDataSetChanged();
}
mBugId.setText(String.valueOf(mCase.getIxBug()));
mBugTitle.setText(String.valueOf(mCase.getTitle()));
mAssignedTo.setText(String.valueOf(mCase.getPersonAssignedTo()));
mProjectView.setText(mCase.getProjectName());
if (!TextUtils.isEmpty(mCase.getFixFor())) {
mMileStone.setText(String.valueOf(mCase.getFixFor()));
}
mActiveStatus.setText(String.valueOf(mCase.getStatus()));
Case bug = mCase;
if (bug.getPriority() <= 3) {
mPriorityIndicator.setBackgroundColor(getResources().getColor(R.color.p3));
} else if (bug.getPriority() == 4) {
mPriorityIndicator.setBackgroundColor(getResources().getColor(R.color.p4));
} else if (bug.getPriority() == 5) {
mPriorityIndicator.setBackgroundColor(getResources().getColor(R.color.p5));
} else if (bug.getPriority() <= 6) {
mPriorityIndicator.setBackgroundColor(getResources().getColor(R.color.p6));
}
}
use of in.bugzy.data.model.CaseEvent in project bugzy by cpunq.
the class BugzyTypeConverters method caseEventListFromString.
@TypeConverter
public static List<CaseEvent> caseEventListFromString(String value) {
Type listType = new TypeToken<List<CaseEvent>>() {
}.getType();
List<CaseEvent> events = sGson.fromJson(value, listType);
if (events != null) {
Collections.sort(events, ((caseEvent, t1) -> Long.compare(t1.getDate().getTime(), caseEvent.getDate().getTime())));
}
return events;
}
Aggregations