Search in sources :

Example 1 with Case

use of in.bugzy.data.model.Case in project bugzy by cpunq.

the class CaseDao method upsertCases.

/**
 * It does a partial UPDATE in case the case is already present
 * @param cases
 */
@Transaction
public void upsertCases(List<Case> cases) {
    long[] ids = insertCases(cases);
    int i = 0;
    for (long id : ids) {
        if (id == -1) {
            // cautiously update
            Case kase = cases.get(i);
            updatePartial(kase.getTitle(), kase.getPriority(), kase.getFixFor(), kase.getProjectName(), kase.getProjectArea(), kase.getStatus(), kase.getPersonAssignedTo(), kase.getPersonOpenedBy(), kase.isFavorite(), kase.getIxBug(), kase.getProjectId(), kase.getFixForId(), kase.getPersonAssignedToId(), kase.getPersonOpenedById(), kase.getProjectAreaId(), kase.getCategoryId());
        }
        i++;
    }
}
Also used : Case(in.bugzy.data.model.Case) Transaction(android.arch.persistence.room.Transaction)

Example 2 with Case

use of in.bugzy.data.model.Case in project bugzy by cpunq.

the class CaseAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    if (holder instanceof HeaderHolder) {
        ((HeaderHolder) holder).bind(mHeaderText);
    }
    if (holder instanceof CaseHolder) {
        Case bug = mBugs.get(getBugPosition(position));
        ((CaseHolder) holder).bindData(bug);
    }
}
Also used : Case(in.bugzy.data.model.Case)

Example 3 with Case

use of in.bugzy.data.model.Case in project bugzy by cpunq.

the class SearchActivity method onItemClick.

@Override
public void onItemClick(int position) {
    Case cas = mCases.get(position);
    Intent i = new Intent(this, CaseDetailsActivity.class);
    Bundle arg = new Bundle();
    arg.putString("bug_id", String.valueOf(cas.getIxBug()));
    arg.putSerializable("bug", cas);
    i.putExtras(arg);
    this.startActivity(i);
}
Also used : Bundle(android.os.Bundle) Intent(android.content.Intent) Case(in.bugzy.data.model.Case)

Example 4 with Case

use of in.bugzy.data.model.Case in project bugzy by cpunq.

the class CaseDetailsActivity method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setAppliedTheme();
    setContentView(R.layout.activity_case_details);
    ButterKnife.bind(this);
    // Parse arguments
    Bundle extras = getIntent().getExtras();
    mFogBugzId = extras.getString("bug_id");
    Case aCase = (Case) extras.getSerializable("bug");
    setupToolbar();
    setupViews();
    if (savedInstanceState == null) {
        CaseDetailsFragment fragment = CaseDetailsFragment.getInstance(mFogBugzId, aCase);
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction().replace(R.id.container_frame, fragment);
        ft.commit();
    }
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) Bundle(android.os.Bundle) Case(in.bugzy.data.model.Case)

Example 5 with Case

use of in.bugzy.data.model.Case 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));
    }
}
Also used : CaseEvent(in.bugzy.data.model.CaseEvent) Case(in.bugzy.data.model.Case) UiThread(android.support.annotation.UiThread)

Aggregations

Case (in.bugzy.data.model.Case)6 Bundle (android.os.Bundle)2 Transaction (android.arch.persistence.room.Transaction)1 Intent (android.content.Intent)1 NonNull (android.support.annotation.NonNull)1 Nullable (android.support.annotation.Nullable)1 UiThread (android.support.annotation.UiThread)1 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 CaseEvent (in.bugzy.data.model.CaseEvent)1 FilterCasesResult (in.bugzy.data.model.FilterCasesResult)1 ApiResponse (in.bugzy.data.remote.ApiResponse)1 NetworkBoundResource (in.bugzy.data.remote.NetworkBoundResource)1 ListCasesData (in.bugzy.data.remote.model.ListCasesData)1 ListCasesRequest (in.bugzy.data.remote.model.ListCasesRequest)1 Response (in.bugzy.data.remote.model.Response)1