Search in sources :

Example 1 with CaseEvent

use of com.bluestacks.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()));
}
Also used : CaseEvent(com.bluestacks.bugzy.data.model.CaseEvent)

Example 2 with CaseEvent

use of com.bluestacks.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);
    }
}
Also used : Parcelable(android.os.Parcelable) CaseEvent(com.bluestacks.bugzy.data.model.CaseEvent)

Example 3 with CaseEvent

use of com.bluestacks.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()));
    mRequiredMerge.setText(mCase.getRequiredMergeIn());
    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(Color.parseColor("#e74c3c"));
    } else if (bug.getPriority() == 4) {
        mPriorityIndicator.setBackgroundColor(Color.parseColor("#95a5a6"));
    } else if (bug.getPriority() == 5) {
        mPriorityIndicator.setBackgroundColor(Color.parseColor("#ddb65b"));
    } else if (bug.getPriority() <= 7) {
        mPriorityIndicator.setBackgroundColor(Color.parseColor("#bdc3c7"));
    } else {
        mPriorityIndicator.setBackgroundColor(Color.parseColor("#ecf0f1"));
    }
}
Also used : CaseEvent(com.bluestacks.bugzy.data.model.CaseEvent) Case(com.bluestacks.bugzy.data.model.Case) UiThread(android.support.annotation.UiThread)

Example 4 with CaseEvent

use of com.bluestacks.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;
}
Also used : CaseEvent(com.bluestacks.bugzy.data.model.CaseEvent) FieldNamingPolicy(com.google.gson.FieldNamingPolicy) List(java.util.List) TypeToken(com.google.gson.reflect.TypeToken) Type(java.lang.reflect.Type) Gson(com.google.gson.Gson) Date(java.util.Date) TypeConverter(android.arch.persistence.room.TypeConverter) Collections(java.util.Collections) GsonBuilder(com.google.gson.GsonBuilder) ArrayList(java.util.ArrayList) Type(java.lang.reflect.Type) List(java.util.List) ArrayList(java.util.ArrayList) CaseEvent(com.bluestacks.bugzy.data.model.CaseEvent) TypeConverter(android.arch.persistence.room.TypeConverter)

Aggregations

CaseEvent (com.bluestacks.bugzy.data.model.CaseEvent)4 TypeConverter (android.arch.persistence.room.TypeConverter)1 Parcelable (android.os.Parcelable)1 UiThread (android.support.annotation.UiThread)1 Case (com.bluestacks.bugzy.data.model.Case)1 FieldNamingPolicy (com.google.gson.FieldNamingPolicy)1 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 TypeToken (com.google.gson.reflect.TypeToken)1 Type (java.lang.reflect.Type)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 Date (java.util.Date)1 List (java.util.List)1