// Path: app/src/main/java/work/technie/popularmovies/utils/RoundedTransformation.java
// public class RoundedTransformation implements com.squareup.picasso.Transformation {
//     private final int radius;
//     private final int margin;  // dp
//     private final String key;
// 
//     // radius is corner radii in dp
//     // margin is the board in dp
//     public RoundedTransformation(final int radius, final int margin) {
//         this.radius = radius;
//         this.margin = margin;
//         this.key = "rounded(radius=" + radius + ", 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.equals(output)) {
//             source.recycle();
//         }
// 
//         return output;
//     }
// 
//     @Override
//     public String key() {
//         return this.key;
//     }
// }
// 
// Path: app/src/main/java/work/technie/popularmovies/utils/ViewHolderUtil.java
// public class ViewHolderUtil {
// 
//     /**
//      * to handle click listener
//      */
//     public interface SetOnClickListener {
//         void onItemClick(int position);
//     }
// }
// 
// Path: app/src/main/java/work/technie/popularmovies/Constants.java
// public static final int COL_VIDEOS_KEY = 2;
// 
// Path: app/src/main/java/work/technie/popularmovies/Constants.java
// public static final int COL_VIDEOS_NAME = 3;


import work.technie.popularmovies.utils.RoundedTransformation;
import work.technie.popularmovies.utils.ViewHolderUtil;
import static work.technie.popularmovies.Constants.COL_VIDEOS_KEY;
import static work.technie.popularmovies.Constants.COL_VIDEOS_NAME;
import android.content.Context;
import android.database.Cursor;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Callback;
import com.squareup.picasso.NetworkPolicy;
import com.squareup.picasso.Picasso;
import work.technie.popularmovies.R;
/*
 * Copyright (C) 2017 Anupam Das
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package work.technie.popularmovies.adapter;





/**
 * Created by anupam on 27/12/15.
 */
public class VideoMovieAdapter extends RecyclerView.Adapter<VideoMovieAdapter.ViewHolder> {

    private final Cursor cursor;
    private Context context;
    private ViewHolderUtil.SetOnClickListener listener;

    public VideoMovieAdapter(Cursor cursor) {
        this.cursor = cursor;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        context = parent.getContext();
        LayoutInflater inflater = LayoutInflater.from(context);

        View view = inflater.inflate(R.layout.list_video_movie, parent, false);

// Path: app/src/main/java/work/technie/popularmovies/utils/RoundedTransformation.java
// public class RoundedTransformation implements com.squareup.picasso.Transformation {
//     private final int radius;
//     private final int margin;  // dp
//     private final String key;
// 
//     // radius is corner radii in dp
//     // margin is the board in dp
//     public RoundedTransformation(final int radius, final int margin) {
//         this.radius = radius;
//         this.margin = margin;
//         this.key = "rounded(radius=" + radius + ", 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.equals(output)) {
//             source.recycle();
//         }
// 
//         return output;
//     }
// 
//     @Override
//     public String key() {
//         return this.key;
//     }
// }
// 
// Path: app/src/main/java/work/technie/popularmovies/utils/ViewHolderUtil.java
// public class ViewHolderUtil {
// 
//     /**
//      * to handle click listener
//      */
//     public interface SetOnClickListener {
//         void onItemClick(int position);
//     }
// }
// 
// Path: app/src/main/java/work/technie/popularmovies/Constants.java
// public static final int COL_VIDEOS_KEY = 2;
// 
// Path: app/src/main/java/work/technie/popularmovies/Constants.java
// public static final int COL_VIDEOS_NAME = 3;


// Path: app/src/main/java/work/technie/popularmovies/adapter/VideoMovieAdapter.java
import work.technie.popularmovies.utils.RoundedTransformation;
import work.technie.popularmovies.utils.ViewHolderUtil;
import static work.technie.popularmovies.Constants.COL_VIDEOS_KEY;
import static work.technie.popularmovies.Constants.COL_VIDEOS_NAME;
import android.content.Context;
import android.database.Cursor;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Callback;
import com.squareup.picasso.NetworkPolicy;
import com.squareup.picasso.Picasso;
import work.technie.popularmovies.R;

/*
 * Copyright (C) 2017 Anupam Das
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package work.technie.popularmovies.adapter;





/**
 * Created by anupam on 27/12/15.
 */
public class VideoMovieAdapter extends RecyclerView.Adapter<VideoMovieAdapter.ViewHolder> {

    private final Cursor cursor;
    private Context context;
    private ViewHolderUtil.SetOnClickListener listener;

    public VideoMovieAdapter(Cursor cursor) {
        this.cursor = cursor;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        context = parent.getContext();
        LayoutInflater inflater = LayoutInflater.from(context);

        View view = inflater.inflate(R.layout.list_video_movie, parent, false);

        return new ViewHolder(view);