package im.actor.sdk.controllers.dialogs.view;

import im.actor.core.entity.Dialog;
import im.actor.sdk.ActorSDK;
import im.actor.sdk.ActorStyle;
import im.actor.sdk.view.adapters.OnItemClickedListener;
import im.actor.runtime.android.view.BindedViewHolder;

public class DialogHolder extends BindedViewHolder {

    protected ActorStyle style = ActorSDK.sharedActor().style;

    private Dialog bindedItem;

    private DialogView dialogView;

    public DialogHolder(DialogView dialogView, final OnItemClickedListener<Dialog> onClickListener) {
        super(dialogView);

        this.dialogView = dialogView;
//
//        pendingColor = style.getDialogsStatePendingColor();
//        sentColor = style.getDialogsStateSentColor();
//        receivedColor = style.getDialogsStateDeliveredColor();
//        readColor = style.getDialogsStateReadColor();
//        errorColor = style.getDialogsStateErrorColor();

//        state = new TintImageView(context);
//        {
//            FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(Screen.dp(28), Screen.dp(12), Gravity.BOTTOM | Gravity.RIGHT);
//            params.bottomMargin = Screen.dp(16);
//            params.rightMargin = Screen.dp(9);
//            state.setLayoutParams(params);
//            fl.addView(state);
//        }


        dialogView.setOnClickListener(v -> {
            if (bindedItem != null) {
                onClickListener.onClicked(bindedItem);
            }
        });
        dialogView.setOnLongClickListener(v -> {
            if (bindedItem != null) {
                return onClickListener.onLongClicked(bindedItem);
            }
            return false;
        });
    }

    public void bind(Dialog data, boolean isLast) {
        this.bindedItem = data;
        this.dialogView.bind(data);
        this.dialogView.setDividerVisible(!isLast);

//        if (data.getSenderId() != myUid() || data.getUnreadCount() > 0) {
//            state.setVisibility(View.GONE);
//        } else {
//            if (data.isRead()) {
//                state.setResource(R.drawable.msg_check_2);
//                state.setTint(readColor);
//            } else if (data.isReceived()) {
//                state.setResource(R.drawable.msg_check_2);
//                state.setTint(receivedColor);
//            } else {
//                state.setResource(R.drawable.msg_check_1);
//                state.setTint(sentColor);
//            }
//            state.setVisibility(View.VISIBLE);
//        }
    }

    public void unbind() {
        this.bindedItem = null;
        this.dialogView.unbind();
    }
}
@@ -610,1888 +610,556 @@
 ew;%0A
-//%0A//        pendingColor = style.getDialogsStatePendingColor();%0A//        sentColor = style.getDialogsStateSentColor();%0A//        receivedColor = style.getDialogsStateDeliveredColor();%0A//        readColor = style.getDialogsStateReadColor();%0A//        errorColor = style.getDialogsStateErrorColor();%0A%0A//        state = new TintImageView(context);%0A//        %7B%0A//            FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(Screen.dp(28), Screen.dp(12), Gravity.BOTTOM %7C Gravity.RIGHT);%0A//            params.bottomMargin = Screen.dp(16);%0A//            params.rightMargin = Screen.dp(9);%0A//            state.setLayoutParams(params);%0A//            fl.addView(state);%0A//        %7D%0A%0A%0A        dialogView.setOnClickListener(v -%3E %7B%0A            if (bindedItem != null) %7B%0A                onClickListener.onClicked(bindedItem);%0A            %7D%0A        %7D);%0A        dialogView.setOnLongClickListener(v -%3E %7B%0A            if (bindedItem != null) %7B%0A                return onClickListener.onLongClicked(bindedItem);%0A            %7D%0A            return false;%0A        %7D);%0A    %7D%0A%0A    public void bind(Dialog data, boolean isLast) %7B%0A        this.bindedItem = data;%0A        this.dialogView.bind(data);%0A        this.dialogView.setDividerVisible(!isLast);%0A%0A//        if (data.getSenderId() != myUid() %7C%7C data.getUnreadCount() %3E 0) %7B%0A//            state.setVisibility(View.GONE);%0A//        %7D else %7B%0A//            if (data.isRead()) %7B%0A//                state.setResource(R.drawable.msg_check_2);%0A//                state.setTint(readColor);%0A//            %7D else if (data.isReceived()) %7B%0A//                state.setResource(R.drawable.msg_check_2);%0A//                state.setTint(receivedColor);%0A//            %7D else %7B%0A//                state.setResource(R.drawable.msg_check_1);%0A//                state.setTint(sentColor);%0A//            %7D%0A//            state.setVisibility(View.VISIBLE);%0A//        %7D
+%0A        dialogView.setOnClickListener(v -%3E %7B%0A            if (bindedItem != null) %7B%0A                onClickListener.onClicked(bindedItem);%0A            %7D%0A        %7D);%0A        dialogView.setOnLongClickListener(v -%3E %7B%0A            if (bindedItem != null) %7B%0A                return onClickListener.onLongClicked(bindedItem);%0A            %7D%0A            return false;%0A        %7D);%0A    %7D%0A%0A    public void bind(Dialog data, boolean isLast) %7B%0A        this.bindedItem = data;%0A        this.dialogView.bind(data);%0A        this.dialogView.setDividerVisible(!isLast);
 %0A   

Remove old code from DialogHolder