package com.wasu.cs.widget;

import android.content.Context;

/**
 * Created by LiuYang on 7/24/15.
 */
public class ViewItemFactory {

	public static final String RECOMMEND_NEWS_ITEM = "Recommend_News_Item";
	public static final String NEWS_SUBJECT_TP1 = "News_Subject_TP1";
	public static final String DETAIL_NEWS = "Detail_News";
	public static final String DETAIL_MOVIE = "Detail_Movie";
	public static final String DETAIL_SERIES = "Detail_Series";

	// 首页推荐第一排列表
	public static final String COLUMN_DETAIL_LIST1 = "Column_Detail_List1";
	public static final String SHORTVIDEO_LIST = "ShortVideo_List";
	public static final String SHORTVIDEO_LIST1 = "ShortVideo_List1";

	private static ViewItemFactory instance;

	public static ViewItemFactory getInstance() {
		if (instance == null) {
			instance = new ViewItemFactory();
		}

		return instance;
	}

	public IViewItem getViewItem(String layout, Context context) {
		IViewItem item = null;

		if (context == null) {
			return item;
		}

		if (layout.equalsIgnoreCase(RECOMMEND_NEWS_ITEM)) {

		} else if (layout.equalsIgnoreCase(NEWS_SUBJECT_TP1)) {
			item = new AssetListLayout(context);
		} else if (layout.equalsIgnoreCase(DETAIL_NEWS) || layout.equalsIgnoreCase(DETAIL_MOVIE) || layout.equalsIgnoreCase(DETAIL_SERIES)) {
			item = new ChannelMovieItem(context);
		} else if (layout.equalsIgnoreCase(SHORTVIDEO_LIST) || layout.equalsIgnoreCase(SHORTVIDEO_LIST1)) {
			item = new AssetListLayout(context);
		} else if(layout.equalsIgnoreCase(COLUMN_DETAIL_LIST1) ){
			item = new ChannelMovieItem(context);
		}
		else {
			item = new ChannelMovieItem(context);
		}

		return item;
	}

}
