@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_image);
    ctx = getApplicationContext();
    if (savedInstanceState != null) {
      index = savedInstanceState.getInt("index");
      projectSite = (ProjectSiteDTO) savedInstanceState.getSerializable("projectSite");
      project = (ProjectDTO) savedInstanceState.getSerializable("project");
    } else {
      project = (ProjectDTO) getIntent().getSerializableExtra("project");
      projectSite = (ProjectSiteDTO) getIntent().getSerializableExtra("projectSite");
      index = getIntent().getIntExtra("index", 0);
    }
    setFields();
    txtNumber.setText("" + (index + 1));

    photoCache = new PhotoCache();
    StringBuilder sb = new StringBuilder();
    sb.append(Statics.IMAGE_URL);
    if (projectSite != null) {
      photoCache.setPhotoUploadList(projectSite.getPhotoUploadList());
      PhotoUploadDTO dto = photoCache.getPhotoUploadList().get(index);
      sb.append(dto.getUri());
      txtTitle.setText(projectSite.getProjectName());
      txtSubTitle.setText(projectSite.getProjectSiteName());
      txtDate.setText(sdf.format(dto.getDateTaken()));
    }
    if (project != null) {
      photoCache.setPhotoUploadList(project.getPhotoUploadList());
      PhotoUploadDTO dto = photoCache.getPhotoUploadList().get(index);
      sb.append(dto.getUri());
      txtTitle.setText(project.getProjectName());
      txtDate.setText(sdf.format(dto.getDateTaken()));
      txtSubTitle.setVisibility(View.GONE);
    }
    url = sb.toString();
    Picasso.with(ctx).load(url).into(imageView);

    Util.animateScaleY(imageView, 200);
    setHeader();
  }
  public static void uploadProjectPicture(
      final Context context,
      final ProjectDTO project,
      final File fullPicture,
      final File thumb,
      Location location) {
    final PhotoUploadDTO dto = getObject(context, fullPicture, thumb, location);
    dto.setProjectID(project.getProjectID());
    dto.setPictureType(PhotoUploadDTO.PROJECT_IMAGE);

    addPhotoToCache(context, dto);
  }