// Path: app/src/main/java/com/photoviewer/presentation/model/PhotoModel.java
// @Accessors(prefix = "m")
// public class PhotoModel {
// 
//     @Getter
//     @Setter
//     private int mId;
// 
//     @Getter
//     @Setter
//     private String mTitle;
// 
//     @Getter
//     @Setter
//     private String mUrl;
// 
//     @Getter
//     @Setter
//     private String mThumbnailUrl;
// }
// 
// Path: app/src/main/java/com/photoviewer/presentation/view/utils/ImageRoundedCornersTransformation.java
// public class ImageRoundedCornersTransformation implements
//         com.squareup.picasso.Transformation {
//     private final int radius;
//     private final int margin;
// 
//     // radius is corner radius in dp
//     // margin is the board in dp
//     public ImageRoundedCornersTransformation(final int radius, final int margin) {
//         this.radius = radius;
//         this.margin = margin;
//     }
// 
//     @Override
//     public Bitmap transform(final Bitmap source) {
//         final Paint paint = new Paint();
//         paint.setAntiAlias(true);
//         paint.setShader(new BitmapShader(source, Shader.TileMode.CLAMP,
//                 Shader.TileMode.CLAMP));
// 
//         Bitmap output = Bitmap.createBitmap(source.getWidth(),
//                 source.getHeight(), Bitmap.Config.ARGB_8888);
//         Canvas canvas = new Canvas(output);
//         canvas.drawRoundRect(new RectF(margin, margin, source.getWidth()
//                 - margin, source.getHeight() - margin), radius, radius, paint);
// 
//         if (source != output) {
//             source.recycle();
//         }
// 
//         return output;
//     }
// 
//     @Override
//     public String key() {
//         return "rounded";
//     }
// }


import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.photoviewer.R;
import com.photoviewer.presentation.model.PhotoModel;
import com.photoviewer.presentation.view.utils.ImageRoundedCornersTransformation;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Transformation;
import java.util.Collection;
import java.util.List;
package com.photoviewer.presentation.view.adapter;


/**
 * Adapter that manages a collection of {@link PhotoModel}.
 */
public class PhotoAdapter extends RecyclerView.Adapter<PhotoAdapter.PhotoViewHolder> {

    private final LayoutInflater mLayoutInflater;
    private final Context mContext;
  private final Picasso mPicasso;
  private List<PhotoModel> mPhotoModelsList;
    private OnItemClickListener mOnItemClickListener;
    private Transformation mImageTransformation;


    //Highlighting
    private String mTextToHighlight;
    private static final String STRING_PREPARED_HIGHLIGHT_MARKUP = "<font color='red'>%s</font>";

  public PhotoAdapter(Context context, Collection<PhotoModel> photoModelsCollection,
      Picasso picasso) {
    validatePhotosCollection(photoModelsCollection);
    mContext = context;
    mLayoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mPhotoModelsList = (List<PhotoModel>) photoModelsCollection;
    mPicasso = picasso;

    setupTransformation();
  }

    public void highlightText(String textToHighlight) {
        mTextToHighlight = textToHighlight;
    }

    @Override
    public int getItemCount() {
        return (mPhotoModelsList != null) ? mPhotoModelsList.size() : 0;
    }

// Path: app/src/main/java/com/photoviewer/presentation/model/PhotoModel.java
// @Accessors(prefix = "m")
// public class PhotoModel {
// 
//     @Getter
//     @Setter
//     private int mId;
// 
//     @Getter
//     @Setter
//     private String mTitle;
// 
//     @Getter
//     @Setter
//     private String mUrl;
// 
//     @Getter
//     @Setter
//     private String mThumbnailUrl;
// }
// 
// Path: app/src/main/java/com/photoviewer/presentation/view/utils/ImageRoundedCornersTransformation.java
// public class ImageRoundedCornersTransformation implements
//         com.squareup.picasso.Transformation {
//     private final int radius;
//     private final int margin;
// 
//     // radius is corner radius in dp
//     // margin is the board in dp
//     public ImageRoundedCornersTransformation(final int radius, final int margin) {
//         this.radius = radius;
//         this.margin = margin;
//     }
// 
//     @Override
//     public Bitmap transform(final Bitmap source) {
//         final Paint paint = new Paint();
//         paint.setAntiAlias(true);
//         paint.setShader(new BitmapShader(source, Shader.TileMode.CLAMP,
//                 Shader.TileMode.CLAMP));
// 
//         Bitmap output = Bitmap.createBitmap(source.getWidth(),
//                 source.getHeight(), Bitmap.Config.ARGB_8888);
//         Canvas canvas = new Canvas(output);
//         canvas.drawRoundRect(new RectF(margin, margin, source.getWidth()
//                 - margin, source.getHeight() - margin), radius, radius, paint);
// 
//         if (source != output) {
//             source.recycle();
//         }
// 
//         return output;
//     }
// 
//     @Override
//     public String key() {
//         return "rounded";
//     }
// }


// Path: app/src/main/java/com/photoviewer/presentation/view/adapter/PhotoAdapter.java
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.photoviewer.R;
import com.photoviewer.presentation.model.PhotoModel;
import com.photoviewer.presentation.view.utils.ImageRoundedCornersTransformation;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Transformation;
import java.util.Collection;
import java.util.List;

package com.photoviewer.presentation.view.adapter;


/**
 * Adapter that manages a collection of {@link PhotoModel}.
 */
public class PhotoAdapter extends RecyclerView.Adapter<PhotoAdapter.PhotoViewHolder> {

    private final LayoutInflater mLayoutInflater;
    private final Context mContext;
  private final Picasso mPicasso;
  private List<PhotoModel> mPhotoModelsList;
    private OnItemClickListener mOnItemClickListener;
    private Transformation mImageTransformation;


    //Highlighting
    private String mTextToHighlight;
    private static final String STRING_PREPARED_HIGHLIGHT_MARKUP = "<font color='red'>%s</font>";

  public PhotoAdapter(Context context, Collection<PhotoModel> photoModelsCollection,
      Picasso picasso) {
    validatePhotosCollection(photoModelsCollection);
    mContext = context;
    mLayoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mPhotoModelsList = (List<PhotoModel>) photoModelsCollection;
    mPicasso = picasso;

    setupTransformation();
  }

    public void highlightText(String textToHighlight) {
        mTextToHighlight = textToHighlight;
    }

    @Override
    public int getItemCount() {
        return (mPhotoModelsList != null) ? mPhotoModelsList.size() : 0;
    }

    @Override