package com.cube.storm.ui.view.holder.list;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.cube.storm.ui.R;
import com.cube.storm.ui.model.list.collection.AppCollectionItem;
import com.cube.storm.ui.view.ImageView;
import com.cube.storm.ui.view.TextView;
import com.cube.storm.ui.view.holder.ViewHolder;
import com.cube.storm.ui.view.holder.ViewHolderFactory;

/**
 * // TODO: Add class description
 *
 * @author Alan Le Fournis
 * @project Storm
 */
public class AppCollectionItemViewHolder extends ViewHolder<AppCollectionItem>
{
	public static class Factory extends ViewHolderFactory
	{
		@Override public AppCollectionItemViewHolder createViewHolder(ViewGroup parent)
		{
			View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.app_collection_item, parent, false);
			return new AppCollectionItemViewHolder(view);
		}
	}

	protected ImageView image;
	protected TextView overlay;

	public AppCollectionItemViewHolder(View view)
	{
		super(view);

		image = (ImageView)view.findViewById(R.id.icon);
		overlay = (TextView)view.findViewById(R.id.overlay);
	}

	@Override public void populateView(final AppCollectionItem model)
	{
		image.populate(model.getIcon());
		overlay.populate(model.getOverlay(), model.getLink());
	}

}

@@ -132,16 +132,50 @@
 Group;%0A%0A
+import com.cube.storm.UiSettings;%0A
 import c
@@ -194,16 +194,16 @@
 m.ui.R;%0A
-
 import c
@@ -260,16 +260,70 @@
 onItem;%0A
+import com.cube.storm.ui.model.property.LinkProperty;%0A
 import c
@@ -669,16 +669,48 @@
 ionItem%3E
+ implements View.OnClickListener
 %0A%7B%0A%09publ
@@ -1071,16 +1071,46 @@
 overlay;
+%0A%09protected LinkProperty link;
 %0A%0A%09publi
@@ -1169,16 +1169,49 @@
 view);%0A%0A
+%09%09view.setOnClickListener(this);%0A
 %09%09image 
@@ -1454,17 +1454,27 @@
 verlay()
-,
+);%0A%09%09link =
  model.g
@@ -1481,17 +1481,175 @@
 etLink()
-)
 ;
+%0A%09%7D%0A%0A%09@Override public void onClick(View view)%0A%09%7B%0A%09%09if (link != null)%0A%09%09%7B%0A%09%09%09UiSettings.getInstance().getLinkHandler().handleLink(view.getContext(), link);%0A%09%09%7D
 %0A%09%7D%0A%0A%7D%0A

Add onClickListener back in so whole view is handled, not just text