private void setAlertLayout(View layout, TextView typeView, AlertDTO alert) {

    typeView.setText(alert.ancServiceType().shortName());

    final AlertStatus alertStatus = alert.alertStatus();
    layout.setBackgroundResource(alertStatus.backgroundColorResourceId());
    typeView.setTextColor(alertStatus.fontColor());
  }
 private void setAlertDateDetails(
     ANCSmartRegisterClient client, AlertDTO alert, TextView dateView) {
   ServiceProvidedDTO servicesProvided = client.getServiceProvidedDTO(alert.name());
   if (isAlertStatusCompleteOrInProcess(alert) && servicesProvided != null) {
     setAlertDate(dateView, alert, servicesProvided.ancServicedOn());
   } else setAlertDate(dateView, alert, null);
 }
 private OnClickFormLauncher launchForm(
     ANCSmartRegisterClient client, AlertDTO alert, String formName) {
   return provider()
       .newFormLauncher(
           formName,
           client.entityId(),
           "{\"entityId\":\"" + client.entityId() + "\",\"alertName\":\"" + alert.name() + "\"}");
 }
  public void setupIFALayout(
      ANCSmartRegisterClient client, NativeANCSmartRegisterViewHolder viewHolder) {
    if (client.isIFADone()) {
      viewHolder.txtIFADoneOn().setVisibility(VISIBLE);
      viewHolder.txtIFADoneOn().setText(client.ifaDoneDate());
    } else {
      viewHolder.txtIFADoneOn().setVisibility(View.INVISIBLE);
    }

    AlertDTO ifaAlert = client.getAlert(ANCServiceType.IFA);
    if (ifaAlert != emptyAlert) {
      viewHolder.btnIFAView().setVisibility(View.INVISIBLE);
      viewHolder.layoutIFAAlert().setVisibility(VISIBLE);
      viewHolder.layoutIFAAlert().setOnClickListener(launchForm(client, ifaAlert, IFA));
      setAlertLayout(viewHolder.layoutIFAAlert(), viewHolder.txtIFADueType(), ifaAlert);
      viewHolder.txtIFADueType().setText(ifaAlert.name());
      setAlertDateDetails(client, ifaAlert, viewHolder.txtIFADueOn());
    } else {
      viewHolder.layoutIFAAlert().setVisibility(View.INVISIBLE);
      viewHolder.btnIFAView().setVisibility(View.INVISIBLE);
      viewHolder.btnIFAView().setOnClickListener(launchForm(client, ifaAlert, IFA));
    }
  }
 private void setAlertDate(TextView dateView, AlertDTO alert, String serviceDate) {
   if (StringUtils.isNotEmpty(serviceDate)) dateView.setText(serviceDate);
   else dateView.setText(getInstance().getStringResource(R.string.str_due) + alert.shortDate());
   dateView.setTextColor(alert.alertStatus().fontColor());
 }
 private boolean isAlertStatusCompleteOrInProcess(AlertDTO ancVisitAlert) {
   return ancVisitAlert.status().equalsIgnoreCase(INPROCESS.name())
       || ancVisitAlert.status().equalsIgnoreCase(COMPLETE.name());
 }