/**
  * This initialises the main android widgets of the layout.
  *
  * @param context the {@link Context}
  */
 private void initialize(Context context) {
   LayoutInflater mInflater =
       (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   mInflater.inflate(R.layout.driveimage, this, true);
   driveLayout = (DriveImageViewLayout) findViewById(R.id.driveImageViewLayout);
   imageView = (ImageView) findViewById(R.id.imageView);
   driveLayout.bringToFront();
 }
  /**
   * Sets the {@link DriveImageModel} to the {@link DriveImageView}. This will cause the
   * DriveImageView to redraw its figures and it also recalculates the size of the Canvas, because
   * the size of the image can change.
   *
   * @param driveImageModel the {@link DriveImageModel}
   */
  public void setDriveImageModel(DriveImageModel driveImageModel) {
    this.driveImageModel = driveImageModel;

    // if (driveImageModel.isDrawable()) {
    //    imageView.setImageResource(driveImageModel.getDrawable());
    // } else {
    Log.d("TTTTTTTT", driveImageModel.getImageBitmap() + "");
    imageView.setImageBitmap(driveImageModel.getImageBitmap());
    // }

    imageView.post(
        new Runnable() {
          @Override
          public void run() {
            driveLayout.setImageViewHeight(imageView.getMeasuredHeight());
            driveLayout.setImageViewWidth(imageView.getMeasuredWidth());
          }
        });

    driveLayout.setFolderText(driveImageModel.getFolderTitle());
    driveLayout.setMainText(driveImageModel.getMainTitle());
  }
 /**
  * Sets the height and width of the folder corner.
  *
  * @param folderCorner height and width in dp.
  */
 public void setFolderCorner(float folderCorner) {
   driveLayout.setFolderCorner(folderCorner);
 }
 @Override
 public void onWindowFocusChanged(boolean hasWindowFocus) {
   driveLayout.setImageViewHeight(imageView.getMeasuredHeight());
   driveLayout.setImageViewWidth(imageView.getMeasuredWidth());
 }
 /**
  * Sets the spacing between the left border of the DriveImageView and the crack before the
  * folder-text.
  *
  * @param customFolderSpacing the desired spacing in dp.
  */
 public void setCustomFolderSpacing(float customFolderSpacing) {
   driveLayout.setCustomFolderSpacing(customFolderSpacing);
 }
 /**
  * Returns the value of the folderCorner.
  *
  * @return the folderCorner value.
  */
 public float getFolderCorner() {
   return driveLayout.getFolderCorner();
 }
 /**
  * Sets the custom height of the whole figure. This recalculates the text-sizes inside the Canvas.
  *
  * @param customHeight the desired height in dp.
  */
 public void setCustomHeight(float customHeight) {
   driveLayout.setCustomHeight(customHeight);
   driveLayout.setImageViewHeight(imageView.getMeasuredHeight());
   driveLayout.setImageViewWidth(imageView.getMeasuredWidth());
 }
 /**
  * Sets the opacity value of all the figures on the canvas.
  *
  * @param alphaValue the opacity (alpha) value in float, between 0f and 1f.
  */
 public void setAlphaValue(float alphaValue) {
   driveLayout.setAlphaValue(alphaValue);
 }
 /**
  * Sets the text-color of both text's (main-text and folder-text)
  *
  * @param textColor the color as a Color-String. Using {@link
  *     android.graphics.Color#parseColor(String)}.
  */
 public void setTextColor(String textColor) {
   driveLayout.setTextColour(textColor);
 }
 /**
  * Sets the background-color of the divider figure.
  *
  * @param divideColor the color as a Color-String. Using {@link
  *     android.graphics.Color#parseColor(String)}.
  */
 public void setDivideColor(String divideColor) {
   driveLayout.setDivideColour(divideColor);
 }
 /**
  * Sets the background-color of the main figure on the canvas.
  *
  * @param backgroundColor the color as a Color-String. Using {@link
  *     android.graphics.Color#parseColor(String)}.
  */
 public void setBackgroundColor(String backgroundColor) {
   driveLayout.setBackgroundColour(backgroundColor);
 }