// Path: chat-message-adapter/src/main/java/com/quickblox/ui/kit/chatmessage/adapter/listeners/QBChatMessageLinkClickListener.java
// public interface QBChatMessageLinkClickListener {
// 
//     /**
//      * This method will be invoked when user press and hold
//      * finger on the {@link TextView}
//      *
//      * @param linkText          Text which contains link on which user presses.
//      * @param linkType          Type of the link can be one of {@link QBMessageTextClickMovement.QBLinkType} enumeration
//      * @param positionInAdapter Index of item with this TextView in message adapter
//      */
//     void onLinkClicked(final String linkText, final QBMessageTextClickMovement.QBLinkType linkType, int positionInAdapter);
// 
//     /**
//      * @param text              Whole text of {@link TextView}
//      * @param positionInAdapter Index of item with this TextView in message adapter
//      */
//     void onLongClick(final String text, int positionInAdapter);
// }


import android.content.Context;
import android.text.Layout;
import android.text.Spannable;
import android.text.method.ArrowKeyMovementMethod;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.util.Patterns;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.widget.TextView;
import com.quickblox.core.helper.Lo;
import com.quickblox.ui.kit.chatmessage.adapter.listeners.QBChatMessageLinkClickListener;
package com.quickblox.ui.kit.chatmessage.adapter.utils;



//TODO VT maybe need move to package core for hide logic from users
public class QBMessageTextClickMovement extends ArrowKeyMovementMethod {

    private final GestureDetector gestureDetector;
    private final boolean overrideOnLinkClick;
    private TextView textView;
    private Spannable buffer;
    private int positionInAdapter = -1;


// Path: chat-message-adapter/src/main/java/com/quickblox/ui/kit/chatmessage/adapter/listeners/QBChatMessageLinkClickListener.java
// public interface QBChatMessageLinkClickListener {
// 
//     /**
//      * This method will be invoked when user press and hold
//      * finger on the {@link TextView}
//      *
//      * @param linkText          Text which contains link on which user presses.
//      * @param linkType          Type of the link can be one of {@link QBMessageTextClickMovement.QBLinkType} enumeration
//      * @param positionInAdapter Index of item with this TextView in message adapter
//      */
//     void onLinkClicked(final String linkText, final QBMessageTextClickMovement.QBLinkType linkType, int positionInAdapter);
// 
//     /**
//      * @param text              Whole text of {@link TextView}
//      * @param positionInAdapter Index of item with this TextView in message adapter
//      */
//     void onLongClick(final String text, int positionInAdapter);
// }


// Path: chat-message-adapter/src/main/java/com/quickblox/ui/kit/chatmessage/adapter/utils/QBMessageTextClickMovement.java
import android.content.Context;
import android.text.Layout;
import android.text.Spannable;
import android.text.method.ArrowKeyMovementMethod;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.util.Patterns;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.widget.TextView;
import com.quickblox.core.helper.Lo;
import com.quickblox.ui.kit.chatmessage.adapter.listeners.QBChatMessageLinkClickListener;

package com.quickblox.ui.kit.chatmessage.adapter.utils;



//TODO VT maybe need move to package core for hide logic from users
public class QBMessageTextClickMovement extends ArrowKeyMovementMethod {

    private final GestureDetector gestureDetector;
    private final boolean overrideOnLinkClick;
    private TextView textView;
    private Spannable buffer;
    private int positionInAdapter = -1;


    public QBMessageTextClickMovement(final QBChatMessageLinkClickListener listener, boolean overrideOnClick, final Context context) {