use of com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener in project android-java-chat-push-notification-app by cometchat-pro.
the class CometChatCalls method setItemClickListener.
/**
* This method helps to get Click events of CometChatCallList
*
* @param onItemClickListener object of the OnItemClickListener
*/
public void setItemClickListener(OnItemClickListener<Call> onItemClickListener) {
this.addOnItemTouchListener(new RecyclerTouchListener(context, this, new ClickListener() {
@Override
public void onClick(View var1, int var2) {
Call call = (Call) var1.getTag(R.string.call);
var1.findViewById(R.id.user_detail_vw).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (onItemClickListener != null)
onItemClickListener.OnItemClick(call, var2);
else
throw new NullPointerException("OnItemClickListener<Call> is null");
}
});
}
@Override
public void onLongClick(View var1, int var2) {
Call call = (Call) var1.getTag(R.string.call);
if (onItemClickListener != null)
onItemClickListener.OnItemLongClick(call, var2);
else
throw new NullPointerException("OnItemClickListener<Call> is null");
}
}));
}
use of com.cometchat.pro.uikit.ui_resources.utils.item_clickListener.OnItemClickListener in project android-java-chat-push-notification-app by cometchat-pro.
the class CometChatCalls method setItemCallClickListener.
/**
* This method helps to get Click events of CometChatCallList
*
* @param onItemClickListener object of the OnItemClickListener
*/
public void setItemCallClickListener(OnItemClickListener<Call> onItemClickListener) {
this.addOnItemTouchListener(new RecyclerTouchListener(context, this, new ClickListener() {
@Override
public void onClick(View var1, int var2) {
String uid;
String type;
Call call = (Call) var1.getTag(R.string.call);
if (call.getReceiverType().equals(CometChatConstants.RECEIVER_TYPE_USER)) {
if (((User) call.getCallInitiator()).getUid().equals(CometChat.getLoggedInUser().getUid())) {
uid = ((User) call.getCallReceiver()).getUid();
} else {
uid = ((User) call.getCallInitiator()).getUid();
}
type = CometChatConstants.RECEIVER_TYPE_USER;
} else {
uid = ((Group) call.getCallReceiver()).getGuid();
type = CometChatConstants.RECEIVER_TYPE_GROUP;
}
var1.findViewById(R.id.call_iv).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Call callObj = new Call(uid, type, CometChatConstants.CALL_TYPE_AUDIO);
if (onItemClickListener != null)
onItemClickListener.OnItemClick(callObj, var2);
else
throw new NullPointerException("OnItemClickListener<Call> is null");
}
});
}
@Override
public void onLongClick(View var1, int var2) {
}
}));
}
Aggregations