/*
 * Copyright (c) 2015, Apptentive, Inc. All Rights Reserved.
 * Please refer to the LICENSE file for the terms and conditions
 * under which redistribution and use of this file is permitted.
 */

package com.apptentive.android.sdk.module.messagecenter.view.holder;

import com.apptentive.android.sdk.module.messagecenter.view.AutomatedMessageView;
import com.apptentive.android.sdk.module.messagecenter.view.CompoundMessageView;
import com.apptentive.android.sdk.module.messagecenter.view.FileMessageView;
import com.apptentive.android.sdk.module.messagecenter.view.IncomingTextMessageView;
import com.apptentive.android.sdk.module.messagecenter.view.MessageCenterListItemView;
import com.apptentive.android.sdk.module.messagecenter.view.MessageCenterStatusView;
import com.apptentive.android.sdk.module.messagecenter.view.OutgoingTextMessageView;

/**
 * @author Sky Kelsey
 */
public class HolderFactory {

	public static MessageCenterListItemHolder createHolder(MessageCenterListItemView messageCenterListItemView) {
		MessageCenterListItemHolder holder = null;
		if (messageCenterListItemView instanceof CompoundMessageView) {
			CompoundMessageView textMessageView = (CompoundMessageView) messageCenterListItemView;
			holder = (textMessageView.isViewShowingOutgoingMessage())? new OutgoingCompoundMessageHolder(textMessageView) :
			new IncomingCompoundMessageHolder(textMessageView);
		}
		else if (messageCenterListItemView instanceof OutgoingTextMessageView) {
			OutgoingTextMessageView textMessageView = (OutgoingTextMessageView) messageCenterListItemView;
			holder = new OutgoingTextMessageHolder(textMessageView);
		} else if (messageCenterListItemView instanceof IncomingTextMessageView) {
			IncomingTextMessageView textMessageView = (IncomingTextMessageView) messageCenterListItemView;
			holder = new IncomingTextMessageHolder(textMessageView);
		} else if (messageCenterListItemView instanceof MessageCenterStatusView) {
			MessageCenterStatusView messageCenterStatusView = (MessageCenterStatusView) messageCenterListItemView;
			holder = new StatusHolder(messageCenterStatusView);
		} else if (messageCenterListItemView instanceof FileMessageView) {
			FileMessageView fileMessageView = (FileMessageView) messageCenterListItemView;
			holder = new OutgoingFileMessageHolder(fileMessageView);
		} else if (messageCenterListItemView instanceof AutomatedMessageView) {
			AutomatedMessageView automatedView = (AutomatedMessageView) messageCenterListItemView;
			holder = new AutomatedMessageHolder(automatedView);
		}
		return holder;
	}
}

@@ -489,361 +489,29 @@
 iew.
-FileMessageView;%0Aimport com.apptentive.android.sdk.module.messagecenter.view.IncomingTextMessageView;%0Aimport com.apptentive.android.sdk.module.messagecenter.view.MessageCenterListItemView;%0Aimport com.apptentive.android.sdk.module.messagecenter.view.MessageCenterStatusView;%0Aimport com.apptentive.android.sdk.module.messagecenter.view.OutgoingTextMessage
+MessageCenterListItem
 View
@@ -1000,16 +1000,16 @@
 View) :%0A
+
 %09%09%09new I
@@ -1059,929 +1059,8 @@
 w);%0A
-%09%09%7D%0A%09%09else if (messageCenterListItemView instanceof OutgoingTextMessageView) %7B%0A%09%09%09OutgoingTextMessageView textMessageView = (OutgoingTextMessageView) messageCenterListItemView;%0A%09%09%09holder = new OutgoingTextMessageHolder(textMessageView);%0A%09%09%7D else if (messageCenterListItemView instanceof IncomingTextMessageView) %7B%0A%09%09%09IncomingTextMessageView textMessageView = (IncomingTextMessageView) messageCenterListItemView;%0A%09%09%09holder = new IncomingTextMessageHolder(textMessageView);%0A%09%09%7D else if (messageCenterListItemView instanceof MessageCenterStatusView) %7B%0A%09%09%09MessageCenterStatusView messageCenterStatusView = (MessageCenterStatusView) messageCenterListItemView;%0A%09%09%09holder = new StatusHolder(messageCenterStatusView);%0A%09%09%7D else if (messageCenterListItemView instanceof FileMessageView) %7B%0A%09%09%09FileMessageView fileMessageView = (FileMessageView) messageCenterListItemView;%0A%09%09%09holder = new OutgoingFileMessageHolder(fileMessageView);%0A
 %09%09%7D 

remove legacy message type dead code