@@ -0,0 +1,3420 @@
+package org.apache.taverna.mobile.ui.adapter;%0A%0Aimport com.bumptech.glide.Glide;%0Aimport com.bumptech.glide.load.engine.DiskCacheStrategy;%0A%0Aimport org.apache.taverna.mobile.R;%0Aimport org.apache.taverna.mobile.data.model.Workflow;%0A%0Aimport android.content.Context;%0Aimport android.net.Uri;%0Aimport android.support.v7.widget.RecyclerView;%0Aimport android.util.Log;%0Aimport android.view.LayoutInflater;%0Aimport android.view.View;%0Aimport android.view.ViewGroup;%0Aimport android.widget.ImageView;%0Aimport android.widget.TextView;%0A%0Aimport java.util.List;%0A%0Aimport butterknife.BindView;%0Aimport butterknife.ButterKnife;%0A%0Apublic class FavouriteWorkflowsAdapter extends RecyclerView.Adapter%3CRecyclerView.ViewHolder%3E %7B%0A%0A    private static final String TAG = FavouriteWorkflowsAdapter.class.getName();%0A%0A    private final List%3CWorkflow%3E mWorkflowList;%0A%0A    private final Context context;%0A%0A    public FavouriteWorkflowsAdapter(List%3CWorkflow%3E mWorkflowList, Context context) %7B%0A        this.mWorkflowList = mWorkflowList;%0A        this.context = context;%0A%0A    %7D%0A%0A    public void addWorkflow(Workflow workflow) %7B%0A        this.mWorkflowList.add(workflow);%0A        this.notifyDataSetChanged();%0A%0A    %7D%0A%0A    @Override%0A    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) %7B%0A        RecyclerView.ViewHolder vh;%0A%0A            View v = LayoutInflater.from(parent.getContext()).inflate(%0A                    R.layout.item_recyclerview_favourite_workflow_list, parent, false);%0A            vh = new ViewHolder(v);%0A%0A        return vh;%0A    %7D%0A%0A    @Override%0A    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) %7B%0A        if (holder instanceof ViewHolder) %7B%0A%0A            Workflow workflow = mWorkflowList.get(position);%0A            String date = workflow.getCreatedAt()%0A                    .substring(0, workflow.getCreatedAt().indexOf(' '));%0A%0A            String title = workflow.getTitle().substring(0,%0A                    Math.min(workflow.getTitle().length(), 50));%0A%0A            if (workflow.getTitle().length() %3E 50) %7B%0A                title = title + %22 ... %22;%0A            %7D%0A%0A            ((ViewHolder) holder).tvDate.setText(date);%0A            ((ViewHolder) holder).tvTitle.setText(title);%0A            ((ViewHolder) holder).tvType.setText(workflow.getType().getContent());%0A            ((ViewHolder) holder).tvUploader.setText(workflow.getUploader().getContent());%0A%0A            Uri uri = Uri.parse(workflow.getPreviewUri());%0A%0A            Glide.with(context)%0A                    .load(uri)%0A                    .diskCacheStrategy(DiskCacheStrategy.SOURCE)%0A                    .placeholder(R.drawable.placeholder)%0A                    .error(R.drawable.placeholder)%0A                    .into(((ViewHolder) holder).ivWorkflowImage);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public int getItemCount() %7B%0A        Log.d(TAG, %22getItemCount: %22 + mWorkflowList.size());%0A        return mWorkflowList.size();%0A    %7D%0A%0A%0A    class ViewHolder extends RecyclerView.ViewHolder %7B%0A%0A        @BindView(R.id.tvDate)%0A        TextView tvDate;%0A%0A        @BindView(R.id.tvTitle)%0A        TextView tvTitle;%0A%0A        @BindView(R.id.tvType)%0A        TextView tvType;%0A%0A        @BindView(R.id.tvUploader)%0A        TextView tvUploader;%0A%0A        @BindView(R.id.ivWorkflowImage)%0A        ImageView ivWorkflowImage;%0A%0A        public ViewHolder(View itemView) %7B%0A            super(itemView);%0A            ButterKnife.bind(this, itemView);%0A%0A        %7D%0A    %7D%0A%0A%7D%0A

add favourite workflow list recyclerview adapter