private void checkAccessStatus(final ViewHolder viewHolder, final CourseComponent unit) {
    dbStore.isUnitAccessed(
        new DataCallback<Boolean>(true) {
          @Override
          public void onResult(Boolean accessed) {
            if (accessed) {
              viewHolder.rowType.setIconColor(
                  context.getResources().getColor(R.color.edx_grayscale_neutral_base));
            } else {
              viewHolder.rowType.setIconColor(
                  context.getResources().getColor(R.color.edx_brand_primary_base));
            }
          }

          @Override
          public void onFail(Exception ex) {
            logger.error(ex);
          }
        },
        unit.getId());
  }
  private View getRowViewForContainer(
      int position, View convertView, ViewGroup parent, final SectionRow row) {
    final CourseComponent component = row.component;
    String courseId = component.getCourseId();
    BlockPath path = component.getPath();
    // FIXME - we should add a new column in database - pathinfo.
    // then do the string match to get the record
    String chapterId = path.get(1) == null ? "" : path.get(1).getDisplayName();
    String sequentialId = path.get(2) == null ? "" : path.get(2).getDisplayName();

    ViewHolder holder = (ViewHolder) convertView.getTag();
    holder.rowTitle.setText(component.getDisplayName());
    holder.numOfVideoAndDownloadArea.setVisibility(View.VISIBLE);
    if (component.isGraded()) {
      holder.bulkDownload.setVisibility(View.INVISIBLE);
      holder.rowSubtitlePanel.setVisibility(View.VISIBLE);
      holder.rowSubtitleIcon.setVisibility(View.VISIBLE);
      holder.rowSubtitle.setVisibility(View.VISIBLE);
      holder.rowSubtitle.setText(component.getFormat());
    }

    // support video download for video type
    final int totalCount = component.getBlockCount().videoCount;
    if (totalCount == 0) {
      holder.numOfVideoAndDownloadArea.setVisibility(View.GONE);
    } else {
      holder.noOfVideos.setVisibility(View.VISIBLE);
      holder.noOfVideos.setText("" + totalCount);

      if (row.numOfVideoNotDownloaded == 0) {
        holder.bulkDownload.setVisibility(View.GONE);
      } else {
        int inProcessCount =
            dbStore.getVideosCountBySection(courseId, chapterId, sequentialId, null);
        int webOnlyCount =
            dbStore.getWebOnlyVideosCountBySection(courseId, chapterId, sequentialId, null);
        row.numOfVideoNotDownloaded = totalCount - inProcessCount - webOnlyCount;
        if (row.numOfVideoNotDownloaded > 0) {
          holder.bulkDownload.setVisibility(View.VISIBLE);
          holder.numOfVideoAndDownloadArea.setOnClickListener(
              new View.OnClickListener() {
                @Override
                public void onClick(View downloadView) {
                  mDownloadListener.download(component.getVideos());
                }
              });
        } else {
          holder.bulkDownload.setVisibility(View.GONE);
        }
      }
    }

    if (AppConstants.offline_flag) {
      holder.numOfVideoAndDownloadArea.setVisibility(View.GONE);
      boolean isVideoDownloaded =
          dbStore.isVideoDownloadedInSection(courseId, chapterId, sequentialId, null);
      if (isVideoDownloaded) {
        // TODO - any UI update
      } else {
        // TODO - any UI update
      }
    } else {
      // TODO - any UI update?
    }

    return convertView;
  }
  private void updateUIForVideo(
      int position, View convertView, final ViewHolder viewHolder, final SectionRow row) {
    VideoBlockModel unit = (VideoBlockModel) row.component;

    viewHolder.rowType.setIcon(Iconify.IconValue.fa_film);
    viewHolder.numOfVideoAndDownloadArea.setVisibility(View.VISIBLE);
    viewHolder.bulkDownload.setVisibility(View.VISIBLE);

    final DownloadEntry videoData = unit.getDownloadEntry(storage);

    viewHolder.rowSubtitlePanel.setVisibility(View.VISIBLE);
    viewHolder.rowSubtitle.setVisibility(View.VISIBLE);
    viewHolder.rowSubtitle.setText(videoData.getDurationReadable());

    if (videoData.downloaded == DownloadEntry.DownloadedState.DOWNLOADING) {

      NativeDownloadModel downloadModel = storage.getNativeDownlaod(videoData.dmId);
      if (downloadModel != null) {
        int percent = downloadModel.getPercent();
        if (percent >= 0 && percent < 100) {
          EventBus.getDefault().post(new DownloadEvent(DownloadEvent.DownloadStatus.STARTED));
        }
      }
    }

    dbStore.getWatchedStateForVideoId(
        videoData.videoId,
        new DataCallback<DownloadEntry.WatchedState>(true) {
          @Override
          public void onResult(DownloadEntry.WatchedState result) {
            DownloadEntry.WatchedState ws = result;
            if (ws == null || ws == DownloadEntry.WatchedState.UNWATCHED) {
              viewHolder.rowType.setIconColor(
                  context.getResources().getColor(R.color.edx_brand_primary_base));
            } else if (ws == DownloadEntry.WatchedState.PARTIALLY_WATCHED) {
              viewHolder.rowType.setIconColor(
                  context.getResources().getColor(R.color.edx_grayscale_neutral_base));
            } else {
              viewHolder.rowType.setIconColor(
                  context.getResources().getColor(R.color.edx_grayscale_neutral_base));
            }
          }

          @Override
          public void onFail(Exception ex) {
            logger.error(ex);
          }
        });

    dbStore.getDownloadedStateForVideoId(
        videoData.videoId,
        new DataCallback<DownloadEntry.DownloadedState>(true) {
          @Override
          public void onResult(DownloadEntry.DownloadedState result) {
            DownloadEntry.DownloadedState ds = result;
            if (ds == null || ds == DownloadEntry.DownloadedState.ONLINE) {
              // not yet downloaded
              viewHolder.bulkDownload.setVisibility(View.VISIBLE);
              viewHolder.numOfVideoAndDownloadArea.setOnClickListener(
                  new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                      EventBus.getDefault()
                          .post(new DownloadEvent(DownloadEvent.DownloadStatus.STARTED));
                      logger.debug("Download Button Clicked");
                      // notifyDataSetChanged();
                      mDownloadListener.download(videoData);
                    }
                  });
            } else if (ds == DownloadEntry.DownloadedState.DOWNLOADING) {
              // may be download in progress
              EventBus.getDefault().post(new DownloadEvent(DownloadEvent.DownloadStatus.STARTED));
              viewHolder.bulkDownload.setVisibility(View.GONE);
              storage.getDownloadProgressByDmid(
                  videoData.dmId,
                  new DataCallback<Integer>(true) {
                    @Override
                    public void onResult(Integer result) {
                      if (result >= 0 && result < 100) {
                        EventBus.getDefault()
                            .post(new DownloadEvent(DownloadEvent.DownloadStatus.STARTED));
                      } else if (result == 100) {
                        EventBus.getDefault()
                            .post(new DownloadEvent(DownloadEvent.DownloadStatus.COMPLETED));
                      }
                    }

                    @Override
                    public void onFail(Exception ex) {
                      logger.error(ex);
                      viewHolder.bulkDownload.setVisibility(View.VISIBLE);
                    }
                  });
            } else if (ds == DownloadEntry.DownloadedState.DOWNLOADED) {
              // downloaded
              viewHolder.bulkDownload.setVisibility(View.GONE);
            }
          }

          @Override
          public void onFail(Exception ex) {
            logger.error(ex);
            viewHolder.bulkDownload.setVisibility(View.VISIBLE);
          }
        });
  }