package com.qiscus.dragonfly;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.qiscus.sdk.data.model.QiscusChatRoom;
import com.qiscus.sdk.ui.fragment.QiscusBaseChatFragment;
import com.qiscus.sdk.ui.view.QiscusRecyclerView;

/**
 * Created on : September 28, 2016
 * Author     : zetbaitsu
 * Name       : Zetra
 * Email      : zetra@mail.ugm.ac.id
 * GitHub     : https://github.com/zetbaitsu
 * LinkedIn   : https://id.linkedin.com/in/zetbaitsu
 */
public class CustomChatFragment extends QiscusBaseChatFragment<CustomChatAdapter> {

    private ImageView attachButton;
    private LinearLayout addPanel;

    public static CustomChatFragment newInstance(QiscusChatRoom qiscusChatRoom) {
        CustomChatFragment fragment = new CustomChatFragment();
        Bundle bundle = new Bundle();
        bundle.putParcelable(CHAT_ROOM_DATA, qiscusChatRoom);
        fragment.setArguments(bundle);
        return fragment;
    }

    @Override
    protected int getResourceLayout() {
        return R.layout.fragment_custom_chat;
    }

    @Override
    protected void onLoadView(View view) {
        super.onLoadView(view);
        swipeRefreshLayout.setProgressViewOffset(false, 0, 128);
        attachButton = (ImageView) view.findViewById(R.id.button_attach);
        addPanel = (LinearLayout) view.findViewById(R.id.add_panel);
        attachButton.setOnClickListener(v -> {
            if (addPanel.getVisibility() == View.GONE) {
                addPanel.startAnimation(animation);
                addPanel.setVisibility(View.VISIBLE);
            } else {
                addPanel.setVisibility(View.GONE);
            }
        });
    }

    @Nullable
    @Override
    protected ViewGroup getEmptyChatHolder(View view) {
        return (ViewGroup) view.findViewById(com.qiscus.sdk.R.id.empty_chat);
    }

    @NonNull
    @Override
    protected SwipeRefreshLayout getSwipeRefreshLayout(View view) {
        return (SwipeRefreshLayout) view.findViewById(com.qiscus.sdk.R.id.swipe_layout);
    }

    @NonNull
    @Override
    protected QiscusRecyclerView getMessageRecyclerView(View view) {
        return (QiscusRecyclerView) view.findViewById(com.qiscus.sdk.R.id.list_message);
    }

    @NonNull
    @Override
    protected EditText getMessageEditText(View view) {
        return (EditText) view.findViewById(com.qiscus.sdk.R.id.field_message);
    }

    @NonNull
    @Override
    protected ImageView getSendButton(View view) {
        return (ImageView) view.findViewById(com.qiscus.sdk.R.id.button_send);
    }

    @Nullable
    @Override
    protected View getNewMessageButton(View view) {
        return view.findViewById(com.qiscus.sdk.R.id.button_new_message);
    }

    @NonNull
    @Override
    protected View getLoadMoreProgressBar(View view) {
        return view.findViewById(com.qiscus.sdk.R.id.progressBar);
    }

    @Nullable
    @Override
    protected ImageView getEmptyChatImageView(View view) {
        return (ImageView) view.findViewById(com.qiscus.sdk.R.id.empty_chat_icon);
    }

    @Nullable
    @Override
    protected TextView getEmptyChatTitleView(View view) {
        return (TextView) view.findViewById(com.qiscus.sdk.R.id.empty_chat_title);
    }

    @Nullable
    @Override
    protected TextView getEmptyChatDescView(View view) {
        return (TextView) view.findViewById(com.qiscus.sdk.R.id.empty_chat_desc);
    }

    @Nullable
    @Override
    protected ImageView getAddImageButton(View view) {
        return (ImageView) view.findViewById(com.qiscus.sdk.R.id.button_add_image);
    }

    @Nullable
    @Override
    protected ImageView getTakeImageButton(View view) {
        return (ImageView) view.findViewById(com.qiscus.sdk.R.id.button_pick_picture);
    }

    @Nullable
    @Override
    protected ImageView getAddFileButton(View view) {
        return (ImageView) view.findViewById(com.qiscus.sdk.R.id.button_add_file);
    }

    @Override
    protected CustomChatAdapter onCreateChatAdapter() {
        return new CustomChatAdapter(getActivity());
    }
}

@@ -2083,39 +2083,24 @@
 indViewById(
-com.qiscus.sdk.
 R.id.empty_c
@@ -2101,24 +2101,24 @@
 mpty_chat);%0A
+
     %7D%0A%0A    @
@@ -2257,39 +2257,24 @@
 indViewById(
-com.qiscus.sdk.
 R.id.swipe_l
@@ -2434,39 +2434,24 @@
 indViewById(
-com.qiscus.sdk.
 R.id.list_me
@@ -2587,39 +2587,24 @@
 indViewById(
-com.qiscus.sdk.
 R.id.field_m
@@ -2738,39 +2738,24 @@
 indViewById(
-com.qiscus.sdk.
 R.id.button_
@@ -2877,39 +2877,24 @@
 indViewById(
-com.qiscus.sdk.
 R.id.button_
@@ -3025,39 +3025,24 @@
 indViewById(
-com.qiscus.sdk.
 R.id.progres
@@ -3183,39 +3183,24 @@
 indViewById(
-com.qiscus.sdk.
 R.id.empty_c
@@ -3343,39 +3343,24 @@
 indViewById(
-com.qiscus.sdk.
 R.id.empty_c
@@ -3503,39 +3503,24 @@
 indViewById(
-com.qiscus.sdk.
 R.id.empty_c
@@ -3661,39 +3661,24 @@
 indViewById(
-com.qiscus.sdk.
 R.id.button_
@@ -3821,39 +3821,24 @@
 indViewById(
-com.qiscus.sdk.
 R.id.button_
@@ -3933,32 +3933,32 @@
 on(View view) %7B%0A
+
         return (
@@ -3986,31 +3986,16 @@
 iewById(
-com.qiscus.sdk.
 R.id.but

Change R class